Title
Lookup in member function declarations
Status
nad
Section
6.5.3 [basic.lookup.unqual]
Submitter
John Spicer

Created on 2017-09-07.00:00:00 last changed 48 months ago

Messages

Date: 2020-12-15.00:00:00

Rationale, June, 2018:

The example is ill-formed: the reference to doit in the return type would refer to the member function in the completed class, which is ill-formed, no diagnostic required, per 6.4.7 [basic.scope.class] paragraph 2.

Date: 2022-11-20.07:54:16

Consider an example like the following:

  template <typename T>
  void doit(const T& t, const T& t2) { }

  template <typename T>
  struct Container {
    auto doit(Container<T> &rhs)
    noexcept(noexcept(doit(T{}, T{})))
       -> decltype(doit(T{}, T{}));
  };

  Container<int> c;

This would appear to be ill-formed because the exception specification is a delayed-parse region, where the lookup is in the context of the completed class, while the lookup in the decltype in the return type is done immediately. The latter should find the two-parameter version of doit, as expected, while the former finds the member, one-parameter version. Current implementations accept the code, however, and it seems unfortunate that the meaning would be different in the two contexts.

History
Date User Action Args
2020-12-15 00:00:00adminsetmessages: + msg6292
2020-12-15 00:00:00adminsetstatus: open -> nad
2017-09-07 00:00:00admincreate