简体   繁体   中英

How to make Clang changle the rules of two-phase lookup?

I want this to compile without an error. Just want it to wait until the instantiation

template<class T>
struct A : public T{
   void f(){ foo(); }
};

int main() {}

You might change your code to:

template<class T>
struct A : public T{
   void f(){ this->foo(); } // or T::foo();
};

int main() {}

making foo type dependent to fix your code.

Two-phase lookup rules is defined by the c++ standard and/or by compiler. Changing rules aren't possible like you can't change laws. You need to tell us what the real problem is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM