Title
Mistaking member typedefs for constructors
Status
cd2
Section
6.5.5.2 [class.qual]
Submitter
Jason Merrill

Created on 2009-11-20.00:00:00 last changed 178 months ago

Messages

Date: 2010-03-15.00:00:00

[Voted into WP at March, 2010 meeting.]

Date: 2010-02-15.00:00:00

Proposed resolution (February, 2010):

Change 6.5.5.2 [class.qual] paragraph 2 as follows:

In a lookup in which the constructor is an acceptable lookup result and the nested-name-specifier nominates a class C:

  • if the name specified after the nested-name-specifier, when looked up in C, is the injected-class-name of C (Clause 11 [class]), or

  • in a using-declaration (9.9 [namespace.udecl]) that is a member-declaration, if the name specified after the nested-name-specifier is the same as the identifier or the simple-template-id's template-name in the last component of the nested-name-specifier,

the name is instead considered to name the constructor of class C...

Date: 2009-11-20.00:00:00

The recent addition to support inherited constructors changed 6.5.5.2 [class.qual] paragraph 2 to say that

if the name specified after the nested-name-specifier is the same as the identifier or the simple-template-id's template-name in the last component of the nested-name-specifier,

the qualified-id is considered to name a constructor. This causes problems for a common naming scheme used in some class libraries:

  struct A {
    typedef int type;
  };
  struct B {
    typedef A type;
  };
  B::type::type t;

This change causes this to name the A constructor instead of the A::type typedef.

History
Date User Action Args
2010-03-29 00:00:00adminsetmessages: + msg2660
2010-03-29 00:00:00adminsetstatus: tentatively ready -> cd2
2010-02-16 00:00:00adminsetmessages: + msg2492
2009-11-20 00:00:00admincreate