decltype is supposed to yield the type of its parameter. A comma expression is supposed to have the type of its right hand operand. In the example below all but c2 are false when compiled with VS2010. When it comes to c1 this is weird to me but clearly standard compliant, while for c4 and c5 I'm not sure... is this correct, or is it a compiler bug? Sadly enough, my real code relied on is_reference to return true in at least for c4.Two last lines of function compiles as expected which shows that the actual evaluation of the comma expression works.I posted this on stackoverflow and the comments I got agreed with my thinking that this is actually a bug.#include <type_traits> void comma() { int str = 1; bool c1 = std::is_reference<decltype(str)>::value; bool c2 = std::is_reference<decltype((str))>::value; bool c3 = std::is_reference<decltype((str, str))>::value; bool c4 = std::is_reference<decltype((str, str))>::value; bool c5 = std::is_reference<decltype((str, (str)))>::value; int& s2 = (1, str); s2 = 2;}
Visual Studio/Silverlight/Tooling version
What category (if any) best represents this feedback?
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results