Title
Lookup context for dependent qualified names
Status
open
Section
6.5.5.1 [basic.lookup.qual.general]
Submitter
Brian Bi

Created on 2024-08-16.00:00:00 last changed 6 days ago

Messages

Date: 2024-09-15.00:00:00

Additional notes (September, 2024)

The proposed wording appears to make the following example unintentionally well-formed:

  int n;
  using T = int;
  int m = T::n;
Date: 2024-09-25.17:32:08

Proposed resolution (approved by CWG 2024-09-13):

Change in 6.5.5.1 [basic.lookup.qual.general] paragraph 3 as follows:

Qualified name lookup in a class, namespace, or enumeration performs a search of the scope associated with it (6.5.2 [class.member.lookup]) except as specified below. Unless otherwise specified, a qualified name undergoes qualified name lookup in its lookup context from the point where it appears unless the lookup context either
  • is dependent and is not the current instantiation (13.8.3.2 [temp.dep.type]), in which case the lookup is done from the point of instantiation (13.8.4.1 [temp.point]), or
  • is not a class or class template a type that is neither a class nor an enumeration, in which case unqualified lookup is performed. [ Note: Such a qualified name can be used to name a destructor (7.5.5.5 [expr.prim.id.dtor]). -- end note ]
If nothing is found by qualified lookup for a member-qualified name that is the terminal name (7.5.5.2 [expr.prim.id.unqual]) of a nested-name-specifier and is not dependent, it undergoes unqualified lookup.
Date: 2024-08-16.00:00:00

(From submission #599.)

Consider:

  template <typename U>
  constexpr bool foo = U::b;

  template <class T>
  struct A {
    A() requires(foo<A>) {}
    static constexpr bool b = true;
  };
  A<int> a;

All implementation accept, but there is no normative wording prescribing the lookup context for U::b.

History
Date User Action Args
2024-09-27 20:34:22adminsetmessages: + msg7823
2024-09-27 20:34:22adminsetstatus: tentatively ready -> open
2024-09-25 17:32:08adminsetstatus: open -> tentatively ready
2024-08-16 14:39:18adminsetmessages: + msg7794
2024-08-16 00:00:00admincreate