This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15865] [DR 147] Invalid variable definition through the constructor name
- From: "giovannibajo at libero dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Aug 2004 01:21:07 -0000
- Subject: [Bug c++/15865] [DR 147] Invalid variable definition through the constructor name
- References: <20040608021123.15865.giovannibajo@libero.it>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From giovannibajo at libero dot it 2004-08-27 01:21 -------
That is misleading, DR 147 clarifies this. It adds this paragraph to
[class.qual]:
If the nested-name-specifier nominates a class C, and the name
specified after the nested-name-specifier, when looked up in C, is the
injected-class-name of C (clause _class_), the name is instead
considered to name the constructor of class C. Such a constructor
name shall be used only in the declarator-id of a constructor
definition that appears outside of the class definition. [Example:
struct A { A(); };
struct B: public A { B(); };
A::A() { }
B::B() { }
B::A ba; // object of type A
A::A a; // error, A::A is not a type name
--end example]
See also testsuite/g++.dg/tc1/dr147.C (xfailed).
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|DUPLICATE |
Summary|Invalid variable definition |[DR 147] Invalid variable
|through the constructor name|definition through the
| |constructor name
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15865