diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 0aeac9d03eed35..5af712dd7257b1 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -11478,7 +11478,7 @@ bool ArrayExprEvaluator::VisitCXXConstructExpr(const CXXConstructExpr *E, bool ArrayExprEvaluator::VisitCXXParenListInitExpr( const CXXParenListInitExpr *E) { - assert(dyn_cast(E->getType()) && + assert(E->getType()->isConstantArrayType() && "Expression result is not a constant array type"); return VisitCXXParenListOrInitListExpr(E, E->getInitExprs(), diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index d97a5c8988840a..17435afab03f49 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -5621,7 +5621,7 @@ static void TryOrBuildParenListInitialization( << SE->getSourceRange(); return; } else { - assert(isa(Entity.getType())); + assert(Entity.getType()->isIncompleteArrayType()); ArrayLength = Args.size(); } EntityIndexToProcess = ArrayLength; diff --git a/clang/test/SemaCXX/paren-list-agg-init.cpp b/clang/test/SemaCXX/paren-list-agg-init.cpp index efc1e955d4ed8c..cc2a9d88dd4a6e 100644 --- a/clang/test/SemaCXX/paren-list-agg-init.cpp +++ b/clang/test/SemaCXX/paren-list-agg-init.cpp @@ -314,8 +314,8 @@ namespace GH63903 { // expected-error {{constexpr variable 's' must be initialized by a constant expression}} } - namespace gh62863 { + int (&&arr)[] = static_cast(42); // beforecxx20-warning@-1 {{aggregate initialization of type 'int[1]' from a parenthesized list of values is a C++20 extension}} int (&&arr1)[1] = static_cast(42); @@ -333,4 +333,23 @@ int (&&arr6)[2] = (int[])(42); // expected-error {{reference to type 'int[2]' co // beforecxx20-warning@-1 {{aggregate initialization of type 'int[1]' from a parenthesized list of values is a C++20 extension}} int (&&arr7)[3] = (int[3])(42); // beforecxx20-warning@-1 {{aggregate initialization of type 'int[3]' from a parenthesized list of values is a C++20 extension}} + +} + +namespace GH92284 { + +using T = int[1]; T x(42); +// beforecxx20-warning@-1 {{aggregate initialization of type 'T' (aka 'int[1]') from a parenthesized list of values is a C++20 extension}} +using Ta = int[2]; Ta a(42); +// beforecxx20-warning@-1 {{aggregate initialization of type 'Ta' (aka 'int[2]') from a parenthesized list of values is a C++20 extension}} +using Tb = int[2]; Tb b(42,43); +// beforecxx20-warning@-1 {{aggregate initialization of type 'Tb' (aka 'int[2]') from a parenthesized list of values is a C++20 extension}} +using Tc = int[]; Tc c(42); +// beforecxx20-warning@-1 {{aggregate initialization of type 'int[1]' from a parenthesized list of values is a C++20 extension}} +using Td = int[]; Td d(42,43); +// beforecxx20-warning@-1 {{aggregate initialization of type 'int[2]' from a parenthesized list of values is a C++20 extension}} +template using ThroughAlias = T[Sz]; +ThroughAlias e(42); +// beforecxx20-warning@-1 {{aggregate initialization of type 'ThroughAlias' (aka 'int[1]') from a parenthesized list of values is a C++20 extension}} + }