From ee9067c51fef4cfa015539574cd9b93ebe7d2656 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 20 Nov 2009 00:59:20 +0000 Subject: When we have a non-dependent expression such as A::f that occurs within a non-static member function with a type-dependent "this", don't consider this to be a case for introduction of an implicit "(*this)." to refer to a specific member function unless we know (at template definition time) that A is a base class of *this. There is some disagreement here between GCC, EDG, and Clang about the handling of this case. I believe that Clang now has the correct, literal interpretation of the standard, but have asked for clarification (c++std-core-15483). llvm-svn: 89425 --- clang/test/SemaTemplate/instantiate-method.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'clang/test/SemaTemplate/instantiate-method.cpp') diff --git a/clang/test/SemaTemplate/instantiate-method.cpp b/clang/test/SemaTemplate/instantiate-method.cpp index df1e1d964eb..a82e84d36c9 100644 --- a/clang/test/SemaTemplate/instantiate-method.cpp +++ b/clang/test/SemaTemplate/instantiate-method.cpp @@ -84,6 +84,8 @@ int *a(A0 &x0, A1 &x1) { struct X0Base { int &f(); + int& g(int); + static double &g(double); }; template @@ -92,9 +94,26 @@ struct X0 : X0Base { template struct X1 : X0 { - int &f2() { return X0Base::f(); } + int &f2() { + return X0Base::f(); // expected-error{{call to non-static member function without an object argument}} + } }; void test_X1(X1 x1i) { int &ir = x1i.f2(); } + +template +struct X2 : X0Base, U { + int &f2() { return X0Base::f(); } +}; + +template +struct X3 { + void test(T x) { + double& d1 = X0Base::g(x); + } +}; + + +template struct X3; -- cgit v1.2.3