Description
Full name of submitter: Brian Bi
Reference (section label): [dcl.init.ref]
Issue description: CWG 2481 was resolved by clarifying that the temporary object in p5.4.2 is cv-qualified if the reference being initialized is cv-qualified. However, this is not the right bullet point for the example given,
constexpr const int &r = 42;
Such an initialization would actually use bullet 5.3.1 instead. (5.4.2 would be used if the initializer were, for example, 3.14
.) We therefore need to make a similar clarification in bullet 5.3, and ideally using the same language.
Suggested resolution: In p5.3, replace the sentence "If the converted initializer is a prvalue, its type T4
is adjusted to type "cv1 T4
" (7.3.6) and the temporary materialization conversion (7.3.5) is applied." with:
"If the converted initializer is a prvalue, let its type be denoted by T4
; the temporary materialization conversion (7.3.5) is applied, considering the type of the prvalue to be "cv1 T4
"."
Although I copied the language from bullet 5.4.2, I have concerns about it; to me, it's still not crystal clear that the decay does not intervene prior to the operation of the temporary materialization conversion. To clarify it, I also propose adding examples. Add the following line to the end of example 5:
const int& r2 = 0; // binds directly to temporary of type `const int`
In example 6, after "rcd2
refers to temporary with", insert " type const double
and".