История изменений
Исправление xaizek, (текущая версия) :
http://eel.is/c draft/class.temporary#6.8
Example:
[...]
const int& b = static_cast<const int&>(0); // temporary int has same lifetime as b
int&& c = cond ? id<int[3]>{1, 2, 3}[i] : static_cast<int&&>(0);
// exactly one of the two temporaries is lifetime-extended
Так что всё нормально (см. после примера ещё notes).
Исходная версия xaizek, :
http://eel.is/c draft/class.temporary#6.8
Example:
[...]
const int& b = static_cast<const int&>(0); // temporary int has same lifetime as b
int&& c = cond ? id<int[3]>{1, 2, 3}[i] : static_cast<int&&>(0);
// exactly one of the two temporaries is lifetime-extended
Так что всё нормально.