Created on 2004-10-21.00:00:00 last changed 207 months ago
[Voted into WP at the October, 2006 meeting.]
Proposed resolution (October, 2005):
Change 11.3 [class.name] paragraph 5 as indicated:
A typedef-name (9.2.4 [dcl.typedef]) that names a class type, or a cv-qualified version thereof, is also aclass-name, butclass-name. If a typedef-name that names a cv-qualified class type is used where a class-name is required, the cv-qualifiers are ignored. A typedef-name shall not be used as the identifier in a class-head.
Delete 9.2.4 [dcl.typedef] paragraph 8:
[Note: if the typedef-name is used where a class-name (or enum-name) is required, the program is ill-formed. For example,
typedef struct { S(); // error: requires a return type because S is // an ordinary member function, not a constructor } S;—end note]
Additional notes (June, 2005):
It's not completely clear what it means to have a cv-qualified type as a base-specifier. The original proposed resolution for issue 298 said that “the cv-qualifiers are ignored,” but that wording is not in the resolution that was ultimately approved.
If the cv-qualifiers are not ignored, does that mean that the base-class subobject should be treated as always similarly cv-qualified, regardless of the cv-qualification of the derived-class lvalue used to access the base-class subobject? For instance:
typedef struct B {
void f();
void f() const;
int i;
} const CB;
struct D: CB { };
void g(D* dp) {
dp->f(); // which B::f?
dp->i = 3; // permitted?
}
Rationale (April, 2005):
The resolution of issue 298 added new text to 11.3 [class.name] paragraph 5 making it clear that a typedef that names a cv-qualified class type is a class-name. Because the definition of base-specifier simply refers to class-name, it is already the case that cv-qualified class types are permitted as base-specifiers.
Issue 298, recently approved, affirms that cv-qualified class types can be used as nested-name-specifiers. Should the same be true for base-specifiers?
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008-10-05 00:00:00 | admin | set | status: wp -> cd1 |
| 2007-05-06 00:00:00 | admin | set | status: dr -> wp |
| 2006-11-05 00:00:00 | admin | set | messages: + msg1438 |
| 2006-11-05 00:00:00 | admin | set | status: ready -> dr |
| 2006-04-22 00:00:00 | admin | set | status: review -> ready |
| 2005-10-22 00:00:00 | admin | set | messages: + msg1244 |
| 2005-10-22 00:00:00 | admin | set | status: open -> review |
| 2005-06-27 00:00:00 | admin | set | messages: + msg1206 |
| 2005-06-27 00:00:00 | admin | set | status: dup -> open |
| 2005-05-01 00:00:00 | admin | set | messages: + msg1201 |
| 2005-05-01 00:00:00 | admin | set | status: open -> dup |
| 2004-10-21 00:00:00 | admin | create | |