summaryrefslogtreecommitdiff
path: root/test/SemaTemplate
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-06-27 01:32:04 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-06-27 01:32:04 +0000
commit2f412f2b9817c1b159472cb3c18438ffdb4a5407 (patch)
tree30add0de63989b15ba4e96acbb2b440f5eda5855 /test/SemaTemplate
parentaffe61a68001370fed6047bec14f7c33519f3731 (diff)
downloadclang-2f412f2b9817c1b159472cb3c18438ffdb4a5407.tar.gz
Diagnose missing 'template' keywords in contexts where a comma is not a
binary operator. Factor out the checking for a comma within potential angle brackets and also call it from contexts where we parse a comma-separated list of arguments or initializers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate')
-rw-r--r--test/SemaTemplate/dependent-template-recover.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/SemaTemplate/dependent-template-recover.cpp b/test/SemaTemplate/dependent-template-recover.cpp
index 617950a4da..37a8faa705 100644
--- a/test/SemaTemplate/dependent-template-recover.cpp
+++ b/test/SemaTemplate/dependent-template-recover.cpp
@@ -32,6 +32,16 @@ struct X {
// FIXME: Is this the right heuristic?
xyz<T::foo < 1>(); // expected-error{{missing 'template' keyword prior to dependent template name 'foo'}}
T::foo < xyz<1>(); // expected-error{{missing 'template' keyword prior to dependent template name 'foo'}}
+
+ sizeof T::foo < 123 > (); // expected-error{{missing 'template' keyword prior to dependent template name 'foo'}}
+ f(t->foo<1, 2>(), // expected-error{{missing 'template' keyword prior to dependent template name 'foo'}}
+ t->bar<3, 4>()); // expected-error{{missing 'template' keyword prior to dependent template name 'bar'}}
+
+ int arr[] = {
+ t->baz<1, 2>(1 + 1), // ok, two comparisons
+ t->foo<1, 2>(), // expected-error{{missing 'template' keyword prior to dependent template name 'foo'}}
+ t->bar<3, 4>() // FIXME: we don't recover from the previous error so don't diagnose this
+ };
}
int xyz;