Dependent base class name lookup (c++ template complete guide)
If you were reading c++ template complete guide : “5.2 using this->” you probably tried to test following example:
template<typename T> class Base { public: void exit() {} }; template<typename T> class Derived : public Base < T > { public: void callMe() { exit(); } };
if you done it under Visual Studio, you have probably realized that it does compile with no errors or warnings, so what is going on here. Your next step should be to test it with gcc or clang compiler, you would see errors now.
The problem is that VS does not implement two phase name lookup. I have found that in VS2013 diabling language extensions with /Za actually causes above code to fail to compile.
some usefull links below
http://blog.llvm.org/2009/12/dreaded-two-phase-name-lookup.html
http://stackoverflow.com/questions/11405/gcc-problem-using-a-member-of-a-base-class-that-depends-on-a-template-argument
http://clang.llvm.org/compatibility.html#dep_lookup_bases
Leave a Reply