jeudi 31 octobre 2019

Is capturing a newly constructed object by const ref undefined behavior

Is the following (contrived example) okay or is it undefined behavior:

// undefined behavior?
const auto& c = SomeClass{};

// use c in code later
const auto& v = c.GetSomeVariable();

Aucun commentaire:

Enregistrer un commentaire