Skip to content

Two conflict notes about member lookup occurred in base-specifier #4775

Open
@xmh0511

Description

@xmh0511

@opensdh
[basic.scope.class#note-1]

[Note 1: Lookup from a program point before the class-specifier of a class will find no bindings in the class scope.

[Example 1:
  
      template < class D >
      struct B {
         D::type x; // #1
      };
      struct A { using type = int; };
      struct C : A, B< C > {}; // error at #1: C​::​type not found.

— end example]

— end note]

The note and the example state that the member lookup from a program point P at a base-specifier cannot find any member.

However, the note [class.member.lookup#note-2] gives a different conclusion, that is

[Note 2: If T is incomplete, only base classes whose base-specifier appears before P are considered. If T is an instantiated class, its base classes are not dependent. — end note]

It seems like the base class A could be considered since it appears before point P in B<C>. In addition, except that P occurs in "base-specifier-list", I cannot figure out a case that there is a base class that can appear after P.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions