https://llvm.org/bugs/show_bug.cgi?id=25645
Bug ID: 25645 Summary: Error when a template-and-non-template-derived-class uses a nested type it inherits from its non-template-base-class Product: clang Version: 3.7 Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: Frontend Assignee: unassignedclangb...@nondot.org Reporter: su...@fb.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified ``` % cat 1.cpp class Base1 { public: typedef int base_int; }; template <typename T> class Base2 {}; template<typename T> class A : public Base1, public Base2<T> { public: base_int f(); }; template<typename T> typename A<T>::base_int A<T>::f() { return 42; } int main() { A<int> a; return a.f(); } % clang++ 1.cpp 1.cpp:16:31: error: return type of out-of-line definition of 'A::f' differs from that in the declaration typename A<T>::base_int A<T>::f() { ~~~~~~~~~~~~~~~~~~~~~~~ ^ 1.cpp:12:12: note: previous declaration is here base_int f(); ~~~~~~~~ ^ 1 error generated. % clang++ --version clang version 3.8.0 (trunk 251726) Target: x86_64-unknown-linux-gnu Thread model: posix ``` Here `base_int` in A<T> comes from `Base1`, which is not a template, and according to look up rules compiler should look in this nondependent base class for base_int. When A<T> inherits only Base1, there is no error. Works with gcc 4.9.2 -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs