diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -346,6 +346,8 @@ potentially problematic function type casts. - Clang will now disambiguate NTTP types when printing diagnostic that contain NTTP types. Fixes `Issue 57562 `_. +- Better error recovery for pack expansion of expressions. + `Issue 58673 `_. Non-comprehensive list of changes in this release ------------------------------------------------- diff --git a/clang/lib/AST/ComputeDependence.cpp b/clang/lib/AST/ComputeDependence.cpp --- a/clang/lib/AST/ComputeDependence.cpp +++ b/clang/lib/AST/ComputeDependence.cpp @@ -573,7 +573,7 @@ // - type-dependent if we don't know the type (fallback to an opaque // dependent type), or the type is known and dependent, or it has // type-dependent subexpressions. - auto D = toExprDependenceForImpliedType(E->getType()->getDependence()) | + auto D = toExprDependenceAsWritten(E->getType()->getDependence()) | ExprDependence::ErrorDependent; // FIXME: remove the type-dependent bit from subexpressions, if the // RecoveryExpr has a non-dependent type. diff --git a/clang/test/CXX/temp/temp.decls/temp.variadic/p5.cpp b/clang/test/CXX/temp/temp.decls/temp.variadic/p5.cpp --- a/clang/test/CXX/temp/temp.decls/temp.variadic/p5.cpp +++ b/clang/test/CXX/temp/temp.decls/temp.variadic/p5.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -fblocks -fms-extensions -fsyntax-only -verify %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -fblocks -fms-extensions -fsyntax-only -verify=expected,cxx11 %s +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++2b -fblocks -fms-extensions -fsyntax-only -verify=expected %s template struct pair; template struct tuple; @@ -164,7 +165,9 @@ // FIXME: this should test that the diagnostic reads "type contains..." struct alignas(Types) TestUnexpandedDecls : T{ // expected-error{{expression contains unexpanded parameter pack 'Types'}} void member_function(Types); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} +#if __cplusplus < 201703L void member_function () throw(Types); // expected-error{{exception type contains unexpanded parameter pack 'Types'}} +#endif void member_function2() noexcept(Types()); // expected-error{{expression contains unexpanded parameter pack 'Types'}} operator Types() const; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}} Types data_member; // expected-error{{data member type contains unexpanded parameter pack 'Types'}} @@ -427,7 +430,7 @@ namespace PR21289 { template using T = int; template struct S { static const int value = 0; }; - template const int vt = 0; // expected-warning {{extension}} + template const int vt = 0; // cxx11-warning {{extension}} int f(...); template void g() { f(T()...); @@ -491,3 +494,11 @@ using t2 = E::B; // expected-note@-1 {{in instantiation of template class 'pr56094::E' requested here}} } // namespace pr56094 + +namespace GH56094 { +#if __cplusplus >= 201402L +template struct A; // expected-note {{template is declared here}} +template using B = char; +template int C{ A>{}... }; // expected-error {{implicit instantiation of undefined template}} +#endif +} // namespace GH56094