Correct behavior: decltype(makeCI()) int , not int const .
The makeCI() function call expression is a prvalue expression. Per C ++ 11 Β§3.10 [basic.lval] / 4:
The prvalues ββclass can have cv-qualified types; non-class prvalues ββalways have cv-unqualified types.
The term "cv-qualification" refers to const- and volatile-qualification. int not a class type, therefore the type of the rvalue makeCI() expression is int , and it is not const-qualified.
(In recent drafts of a C ++ language standard, such as N3690, this text has been deleted and replaced with a new text in Β§5 [expr] / 6, which states: "If the prvalue value is originally of type" cv T "," where T is unqualified unclassified, non-massive type, type of expression until parsed . "See CWG defect 1261. )
James McNellis
source share