Author: Corentin Jabot Date: 2026-09-10T09:36:09+02:00 New Revision: 96295a1412f9afbee9d4a3c2701e83f5a529a9cc
URL: https://github.com/llvm/llvm-project/commit/96295a1412f9afbee9d4a3c2701e83f5a529a9cc DIFF: https://github.com/llvm/llvm-project/commit/96295a1412f9afbee9d4a3c2701e83f5a529a9cc.diff LOG: [Clang] Fix a crash when forming a type from an indexed TTP. (#222326) Unreported 24 issue so no release note. Added: Modified: clang/lib/Parse/ParseExpr.cpp clang/test/SemaCXX/cxx2d-pack-indexing-template.cpp Removed: ################################################################################ diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index fd6b290d9b673..ef89b77d0a997 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -905,7 +905,7 @@ Parser::ParseCastExpression(CastParseKind ParseKind, bool isAddressOfOperand, if (TryAnnotateTypeOrScopeToken()) return ExprError(); if (Tok.isOneOf(tok::annot_cxxscope, tok::annot_pack_indexing_type, - tok::annot_template_id)) + tok::annot_template_id, tok::annot_typename)) return ParseCastExpression(ParseKind, isAddressOfOperand, CorrectionBehavior, isVectorLiteral, NotPrimaryExpression); diff --git a/clang/test/SemaCXX/cxx2d-pack-indexing-template.cpp b/clang/test/SemaCXX/cxx2d-pack-indexing-template.cpp index 0298be66b1a86..f1d9b1b8ce3d0 100644 --- a/clang/test/SemaCXX/cxx2d-pack-indexing-template.cpp +++ b/clang/test/SemaCXX/cxx2d-pack-indexing-template.cpp @@ -105,6 +105,18 @@ auto ctad() { return x; } static_assert(__is_same(decltype(ctad<Deduce>()), Deduce<int>)); + +template <template <class> class... TT> +auto ctad_paren() { + return TT...[0](42); +} +static_assert(__is_same(decltype(ctad_paren<Deduce>()), Deduce<int>)); + +template <template <class> class... TT> +auto ctad_braced() { + return TT...[1]{42}; +} +static_assert(__is_same(decltype(ctad_braced<A, Deduce>()), Deduce<int>)); } namespace deduction_guides { _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
