This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 113d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-03-20


1000. Mistaking member typedefs for constructors

Section: 6.5.5.2  [class.qual]     Status: CD2     Submitter: Jason Merrill     Date: 20 November, 2009

[Voted into WP at March, 2010 meeting.]

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.

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:

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