Title
Name lookup of dependent conversion function
Status
cd6
Section
13.8.4.2 [temp.dep.candidate]
Submitter
Johannes Schaub

Created on 2012-04-27.00:00:00 last changed 20 months ago

Messages

Date: 2020-11-15.00:00:00

[Accepted at the November, 2020 meeting as part of paper P1787R6 and moved to DR at the February, 2021 meeting.]

Consider the following example:

  template<typename T>
  struct A {
   operator int() { return 0; }

   void f() {
    operator T();
   }
  };

  int main() {
   A<int> a;
   a.f();
  }

One might expect this to call operator int when instantiating. But since operator T is a dependent name, it is looked up by unqualified lookup only in the definition context, where it will find no declaration. Argument-dependent lookup will not find anything in the instantiation context either, so this code is ill-formed. If we change operatorĀ int() to operatorĀ T(), which is a seemingly unrelated change, the code becomes well-formed.

There is implementation variability on this point.

History
Date User Action Args
2022-08-19 07:54:33adminsetstatus: drwp -> cd6
2021-02-24 00:00:00adminsetstatus: accepted -> drwp
2020-12-15 00:00:00adminsetstatus: open -> accepted
2012-04-27 00:00:00admincreate