apparently MSVC has no problem binding temporaries to lvalue references... why yes, of course, let's break the most basic building blocks of the language

@namark i'll never completely understand this lvlaue rvalue xvalue thing
Follow

@mew27 The naming convention is terrible for the value categories, there is a better categorization with a W shaped graph, but I can't quite find it right now...

This case though is pretty simple, lvalue is so your run of the mill variables (or function parameters), and a temporary is just a temporary, that's going to be destroyed before the next "statement". According to the language standard it's an insta-dangling reference and is forbidden. Like this:
int& x = 1;

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.