summaryrefslogtreecommitdiff
path: root/test/SemaTemplate/template-id-expr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-06-14 22:07:54 +0000
committerDouglas Gregor <dgregor@apple.com>2010-06-14 22:07:54 +0000
commit732281de5d518fca96c449ae185ee56bde422c4f (patch)
tree735d7038365f46feb5b83f8ad329dad3153d6780 /test/SemaTemplate/template-id-expr.cpp
parenteda3f707fd53f90f4232b0e694d3f5514237aba5 (diff)
downloadclang-732281de5d518fca96c449ae185ee56bde422c4f.tar.gz
Warn when a 'typename' or a 'template' keyword refers to a
non-dependent type or template name, respectively, in C++98/03. Fixes PR7111 and <rdar://problem/8002682>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105968 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/template-id-expr.cpp')
-rw-r--r--test/SemaTemplate/template-id-expr.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/SemaTemplate/template-id-expr.cpp b/test/SemaTemplate/template-id-expr.cpp
index de8d7f6c91..e8974211b6 100644
--- a/test/SemaTemplate/template-id-expr.cpp
+++ b/test/SemaTemplate/template-id-expr.cpp
@@ -62,12 +62,12 @@ struct Y0 {
template<typename U>
void f() {
- Y0::template f1<U>(0);
- Y0::template f1(0);
+ Y0::template f1<U>(0); // expected-warning{{'template' refers to a non-dependent template name}}
+ Y0::template f1(0); // expected-warning{{'template' refers to a non-dependent template name}}
this->template f1(0);
- Y0::template f2<U>(0);
- Y0::template f2(0);
+ Y0::template f2<U>(0); // expected-warning{{'template' refers to a non-dependent template name}}
+ Y0::template f2(0);// expected-warning{{'template' refers to a non-dependent template name}}
Y0::template f3(0); // expected-error {{'f3' following the 'template' keyword does not refer to a template}}
Y0::template f3(); // expected-error {{'f3' following the 'template' keyword does not refer to a template}}
@@ -75,7 +75,8 @@ struct Y0 {
int x;
x = Y0::f4(0);
x = Y0::f4<int>(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}
- x = Y0::template f4(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}
+ x = Y0::template f4(0); // expected-error {{assigning to 'int' from incompatible type 'void'}} \
+ // expected-warning{{'template' refers to a non-dependent template name}}
x = this->f4(0);
x = this->f4<int>(0); // expected-error {{assigning to 'int' from incompatible type 'void'}}