[Bug c++/15865] [DR 147] Invalid variable definition through the constructor name

giovannibajo at libero dot it gcc-bugzilla@gcc.gnu.org
Fri Aug 27 01:21:00 GMT 2004


------- 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



More information about the Gcc-bugs mailing list