diff options
| author | Richard Smith <richard@metafoo.co.uk> | 2020-01-17 15:42:11 -0800 |
|---|---|---|
| committer | Saar Raz <saar@raz.email> | 2020-01-24 02:28:20 +0200 |
| commit | ab514b91196345ba4c61026e4997871e85ddd97d (patch) | |
| tree | 953c9e6226fd9cd37dda565b3b11bd6791b81184 /clang/test | |
| parent | 57f70e387e362d988937b6627461d781ecf09e50 (diff) | |
| download | bcm5719-llvm-ab514b91196345ba4c61026e4997871e85ddd97d.tar.gz bcm5719-llvm-ab514b91196345ba4c61026e4997871e85ddd97d.zip | |
Remove redundant CXXScopeSpec from TemplateIdAnnotation.
A TemplateIdAnnotation represents only a template-id, not a
nested-name-specifier plus a template-id. Don't make a redundant copy of
the CXXScopeSpec and store it on the template-id annotation.
This slightly improves error recovery by more properly handling the case
where we would form an invalid CXXScopeSpec while parsing a typename
specifier, instead of accidentally putting the token stream into a
broken "annot_template_id with a scope specifier, but with no preceding
annot_cxxscope token" state.
(cherry picked from commit a42fd84cff265b7e9faa3fe42885ee171393e4db)
Diffstat (limited to 'clang/test')
4 files changed, 8 insertions, 10 deletions
diff --git a/clang/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2.cpp b/clang/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2.cpp index 68a41c7184c..6c0df1aff23 100644 --- a/clang/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2.cpp +++ b/clang/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2.cpp @@ -16,6 +16,6 @@ template<int n> struct T { typename S<k>::T check3; // ok, u is value-dependent const int &i = k; - typename S<i>::T check4; // expected-error {{not an integral constant expression}} expected-error {{qualified name}} + typename S<i>::T check4; // expected-error {{not an integral constant expression}} } }; diff --git a/clang/test/Parser/cxx-decl.cpp b/clang/test/Parser/cxx-decl.cpp index a868904bb36..1914f347d9d 100644 --- a/clang/test/Parser/cxx-decl.cpp +++ b/clang/test/Parser/cxx-decl.cpp @@ -238,12 +238,11 @@ namespace PR5066 { namespace PR17255 { void foo() { - typename A::template B<>; // expected-error {{use of undeclared identifier 'A'}} - // expected-error@-1 {{'template' keyword not permitted here}} + typename A::template B<> c; // expected-error {{use of undeclared identifier 'A'}} #if __cplusplus <= 199711L + // expected-error@-2 {{'typename' occurs outside of a template}} // expected-error@-3 {{'template' keyword outside of a template}} #endif - // expected-error@-5 {{expected a qualified name after 'typename'}} } } diff --git a/clang/test/SemaTemplate/ms-delayed-default-template-args.cpp b/clang/test/SemaTemplate/ms-delayed-default-template-args.cpp index beb64f8273d..27646487534 100644 --- a/clang/test/SemaTemplate/ms-delayed-default-template-args.cpp +++ b/clang/test/SemaTemplate/ms-delayed-default-template-args.cpp @@ -93,7 +93,7 @@ namespace test_undeclared_nontype_parm_arg { // template parameter. template <typename T> struct Bar { T x; }; -template <Bar<Xylophone> *P> // expected-error {{use of undeclared identifier 'Xylophone'}} +template <Bar<Xylophone> *P> // expected-error {{use of undeclared identifier 'Xylophone'}} expected-note {{declared here}} struct Foo { }; typedef int Xylophone; diff --git a/clang/test/SemaTemplate/rdar9173693.cpp b/clang/test/SemaTemplate/rdar9173693.cpp index ed09a64a0dd..76919e265fd 100644 --- a/clang/test/SemaTemplate/rdar9173693.cpp +++ b/clang/test/SemaTemplate/rdar9173693.cpp @@ -2,8 +2,7 @@ // <rdar://problem/9173693> template< bool C > struct assert { }; -// FIXME: We diagnose the same problem multiple times here because we have no -// way to indicate in the token stream that we already tried to annotate a -// template-id and we failed. -template< bool > struct assert_arg_pred_impl { }; // expected-note 4 {{declared here}} -template< typename Pred > assert<false> assert_not_arg( void (*)(Pred), typename assert_arg_pred<Pred>::type ); // expected-error 6 {{}} +template< bool > struct assert_arg_pred_impl { }; // expected-note 2 {{declared here}} +template< typename Pred > assert<false> assert_not_arg( void (*)(Pred), typename assert_arg_pred<Pred>::type ); +// expected-error@-1 {{did you mean 'assert_arg_pred_impl'}} +// expected-error@-2 {{template argument for non-type template parameter must be an expression}} |

