diff options
author | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
commit | 952eddef9aff85b1e92626e89baaf7a360e2ac85 (patch) | |
tree | df8df0b0067b381eab470a3b8f28d14a552a6340 /test/Parser/cxx-template-argument.cpp | |
parent | ea266cad53e3d49771fa38103913d3ec7a166694 (diff) | |
download | FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.zip FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.tar.gz |
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841
Diffstat (limited to 'test/Parser/cxx-template-argument.cpp')
-rw-r--r-- | test/Parser/cxx-template-argument.cpp | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/test/Parser/cxx-template-argument.cpp b/test/Parser/cxx-template-argument.cpp index afe318d..8bf2a4f 100644 --- a/test/Parser/cxx-template-argument.cpp +++ b/test/Parser/cxx-template-argument.cpp @@ -5,7 +5,7 @@ template<typename T> struct A {}; // Check for template argument lists followed by junk // FIXME: The diagnostics here aren't great... A<int+> int x; // expected-error {{expected '>'}} expected-error {{expected unqualified-id}} -A<int x; // expected-error {{expected '>'}} +A<int x; // expected-error {{type-id cannot have a name}} expected-error {{expected '>'}} // PR8912 template <bool> struct S {}; @@ -42,3 +42,66 @@ namespace PR13210 { new C(); // expected-error {{requires template arguments}} } } + +// Don't emit spurious messages +namespace pr16225add { + + template<class T1, typename T2> struct Known { }; // expected-note 3 {{template is declared here}} + template<class T1, typename T2> struct X; + template<class T1, typename T2> struct ABC; // expected-note {{template is declared here}} + template<int N1, int N2> struct ABC2 {}; + + template<class T1, typename T2> struct foo : + UnknownBase<T1,T2> // expected-error {{unknown template name 'UnknownBase'}} + { }; + + template<class T1, typename T2> struct foo2 : + UnknownBase<T1,T2>, // expected-error {{unknown template name 'UnknownBase'}} + Known<T1> // expected-error {{too few template arguments for class template 'Known'}} + { }; + + template<class T1, typename T2> struct foo3 : + UnknownBase<T1,T2,ABC<T2,T1> > // expected-error {{unknown template name 'UnknownBase'}} + { }; + + template<class T1, typename T2> struct foo4 : + UnknownBase<T1,ABC<T2> >, // expected-error {{unknown template name 'UnknownBase'}} \ + // expected-error {{too few template arguments for class template 'ABC'}} + Known<T1> // expected-error {{too few template arguments for class template 'Known'}} + { }; + + template<class T1, typename T2> struct foo5 : + UnknownBase<T1,T2,ABC<T2,T1>> // expected-error {{unknown template name 'UnknownBase'}} \ + // expected-error {{use '> >'}} + { }; + + template<class T1, typename T2> struct foo6 : + UnknownBase<T1,ABC<T2,T1>>, // expected-error {{unknown template name 'UnknownBase'}} \ + // expected-error {{use '> >'}} + Known<T1> // expected-error {{too few template arguments for class template 'Known'}} + { }; + + template<class T1, typename T2, int N> struct foo7 : + UnknownBase<T1,T2,(N>1)> // expected-error {{unknown template name 'UnknownBase'}} + { }; + + template<class T1, typename T2> struct foo8 : + UnknownBase<X<int,int>,X<int,int>> // expected-error {{unknown template name 'UnknownBase'}} \ + // expected-error {{use '> >'}} + { }; + + template<class T1, typename T2> struct foo9 : + UnknownBase<Known<int,int>,X<int,int>> // expected-error {{unknown template name 'UnknownBase'}} \ + // expected-error {{use '> >'}} + { }; + + template<class T1, typename T2> struct foo10 : + UnknownBase<Known<int,int>,X<int,X<int,int>>> // expected-error {{unknown template name 'UnknownBase'}} \ + // expected-error {{use '> >'}} + { }; + + template<int N1, int N2> struct foo11 : + UnknownBase<2<N1,N2<4> // expected-error {{unknown template name 'UnknownBase'}} + { }; + +} |