typedef decltype(true ? (long&&)0 : (long&&)0) T;
What should T be?
According to gcc (4.7), it’s long. According to clang (trunk), it’s long&&. This difference is causing clang to fail to compile code that uses gcc 4.7’s libstdc++. Who is right?
UPDATE: As ildjarn points out, Clang is right, and as Richard Smith points out, the error libstdc++ is due to an error in the Standard. Here is the relevant GCC bug, and the relevant Defect Report.
Clang is right. N3337 §7.1.6.2/4:
§5/6:
I was wary earlier that a literal
0may somehow prevent this from qualifying as an object type in this context, but §3.9/8 clarifies things:The conditional operator doesn’t affect anything here – §5.16/4:
In this case both are of the same value category (xvalue), and xvalues are glvalues.