> int a{}, b = decltype((a)){a}; GCC falsely rejects this (https://godbolt.org/z/a6c4h8Mhv). If you're having trouble reading this, it also rejects: > using T = int&; > int a{}, b = T{a}; Splitting this into multiple lines is also not relevant. The error is: > <source>:3:17: error: cannot bind non-const lvalue reference of type 'T' {aka 'int&'} to an rvalue of type 'int' > 3 | int a{}, b = T{a}; > | ^ There is no apparent reason why should be an rvalue in this context. It is not move-eligible within the initializer of a variable. My guess is something something aggregate initialization doing copy-initialization for each initializer and then getting a prvalue out of that. Dunno, it's quite weird. See https://stackoverflow.com/a/78477064/5740428 for a more in-depth explanation of the relevant wording.
Another user suggested that this is caused by falsely performing temporary materialization. This would make a an xvalue, which would also make the reference binding fail.
I think there is a dup of this bug already filed ...
See https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1521 also.
https://github.com/cplusplus/CWG/issues/536
Maybe related bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64892 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78209