Title
Differing member lookup from nested classes
Status
ready
Section
6.5.2 [class.member.lookup]
Submitter
Jason Merrill

Created on 2022-05-02.00:00:00 last changed 3 weeks ago

Messages

Date: 2022-05-06.20:24:57

Proposed resolution:

Change in 6.5.2 [class.member.lookup] paragraph 6 as follows:

If it differs from the result of a search in T for N from immediately after the class-specifier in a complete-class context of T, the program is ill-formed, no diagnostic required.

Approved by CWG 2022-05-06.

Date: 2022-05-02.00:00:00

Consider:

  typedef int T;
  struct A {
   struct B {
    static T t;
   };
   typedef float T; // IFNDR?
  };

Subclause 6.5.2 [class.member.lookup] paragraph 6 specifies:

The result of the search is the declaration set of S(N, T). If it is an invalid set, the program is ill-formed. If it differs from the result of a search in T for N from immediately after the class-specifier of T, the program is ill-formed, no diagnostic required.

It is unclear whether the lookup of T inside A::B is subject to the "if it differs" rule, given that the class-specifier of A::B ends before introducing A::T.

History
Date User Action Args
2022-05-06 20:24:57adminsetstatus: open -> ready
2022-05-02 16:09:03adminsetmessages: + msg6821
2022-05-02 00:00:00admincreate