This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/20330] Constructor fails to find base class in specialization


------- Additional Comments From bangerth at dealii dot org  2005-03-14 16:25 -------
The place to look at is 12.6.2/2: 
 
2 Names  in  a  mem-initializer-id  are  looked  up  in the scope of the 
  constructor's class and, if not found in that scope, are looked up  in 
  the  scope  containing  the  constructor's  definition.  [Note: if the 
  constructor's class contains a member with the same name as  a  direct 
  or  virtual  base  class of the class, a mem-initializer-id naming the 
 
  member or base class and composed of a single identifier refers to the 
  class  member.   A mem-initializer-id for the hidden base class may be 
  specified using a qualified name.   ]  Unless  the  mem-initializer-id 
  names  a  nonstatic data member of the constructor's class or a direct 
  or virtual base of that class, the mem-initializer is  ill-formed.   A 
  mem-initializer-list  can  initialize a base class using any name that 
  denotes that base class type.  
 
Obviously, in the scope of the constructor, both the name of the base 
class and the name of the member of foo are visible. The standard specifies 
that this then denotes the member variable, and the sentence after that 
states that this is then an error because the variable is not one of the 
present class. 
 
In other words, gcc's behavior is correct even though there would be an 
unambiguous resolution in this very particular case. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20330


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]