Created on 2009-10-19.00:00:00 last changed 178 months ago
[Voted into WP at March, 2010 meeting.]
Proposed resolution (October, 2009):
Delete 9.2.4 [dcl.typedef] paragraph 9:
If a typedef TD names a type that is a reference to a type T, an attempt to create the type “lvalue reference to cv TD” creates the type “lvalue reference to T,” while an attempt to create the type “rvalue reference to cv TD” creates the type TD. [Example: ... —end example]
Delete 13.4.2 [temp.arg.type] paragraph 4:
If a template-argument for a template-parameter T names a type that is a reference to a type A, an attempt to create the type “lvalue reference to cv T” creates the type “lvalue reference to A,” while an attempt to create the type “rvalue reference to cv T” creates the type T [Example: ... —end example]
Add the following as a new paragraph at the end of 9.3.4.3 [dcl.ref]:
If a typedef (9.2.4 [dcl.typedef]), a type template-parameter (13.4.2 [temp.arg.type]), or a decltype-specifier (9.2.9.3 [dcl.type.simple]) denotes a type TR that is a reference to a type T, an attempt to create the type “lvalue reference to cv TR” creates the type “lvalue reference to T,” while an attempt to create the type “rvalue reference to cv TR” creates the type TR. [Example:
int i; typedef int& LRI; typedef int&& RRI; LRI& r1 = i; // r1 has the type int& const LRI& r2 = i; // r2 has the type int& const LRI&& r3 = i; // r3 has the type int& RRI& r4 = i; // r4 has the type int& RRI&& r5 = i; // r5 has the type int&& decltype(r2)& r6 = i; // r6 has the type int& decltype(r2)&& r7 = i; // r7 has the type int&—end example]
References to references are ill-formed, but special provision is made in cases where this occurs via typedefs or template type parameters. A similar provision is probably needed for types resulting from decltype:
int x, *p = &x; decltype(*p) &y = *p; // reference to reference is ill-formed
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-03-29 00:00:00 | admin | set | messages: + msg2687 |
2010-03-29 00:00:00 | admin | set | status: ready -> cd2 |
2009-11-08 00:00:00 | admin | set | messages: + msg2349 |
2009-10-19 00:00:00 | admin | create |