diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-11-20 00:59:20 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-11-20 00:59:20 +0000 |
commit | ee9067c51fef4cfa015539574cd9b93ebe7d2656 (patch) | |
tree | 5bc7d63261fc93f2e6ce3703b60284a32fbaad98 /clang/test/SemaTemplate/instantiate-method.cpp | |
parent | d1782cc478ae5dbe528e7211db68697cc6219696 (diff) | |
download | bcm5719-llvm-ee9067c51fef4cfa015539574cd9b93ebe7d2656.tar.gz bcm5719-llvm-ee9067c51fef4cfa015539574cd9b93ebe7d2656.zip |
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
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-method.cpp')
-rw-r--r-- | clang/test/SemaTemplate/instantiate-method.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
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<int> &x0, A1<int> &x1) { struct X0Base { int &f(); + int& g(int); + static double &g(double); }; template<typename T> @@ -92,9 +94,26 @@ struct X0 : X0Base { template<typename U> struct X1 : X0<U> { - 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<int> x1i) { int &ir = x1i.f2(); } + +template<typename U> +struct X2 : X0Base, U { + int &f2() { return X0Base::f(); } +}; + +template<typename T> +struct X3 { + void test(T x) { + double& d1 = X0Base::g(x); + } +}; + + +template struct X3<double>; |