A const reference member initialized from a temporary

What happens when this program runs?

main.cpp
#include <iostream>
#include <string>

struct Wrapper {
    const std::string& ref;
    Wrapper(const std::string& s) : ref(s) {}
};

int main() {
    Wrapper w(std::string("temp"));
    std::cout << w.ref << std::endl;
}

7 of 117 in C++