https://github.com/Sriraj2911 updated 
https://github.com/llvm/llvm-project/pull/235408

>From 99ae654aab9c2099076989887d54bc107b3dab77 Mon Sep 17 00:00:00 2001
From: Sriraj2911 <[email protected]>
Date: Mon, 26 Oct 2026 11:51:11 +0530
Subject: [PATCH] [clang][Sema] Fix assertion crash on invalid concept template
 parameter (#225792)

Fixes an assertion failure ('Parameter && \'A variable template id without 
template?\'')
in CheckVarOrConceptTemplateTemplateId when processing malformed concept 
template parameters.

Fixes #225792
---
 clang/lib/Sema/SemaTemplate.cpp |  3 +++
 clang/test/SemaCXX/225792.cpp   | 10 ++++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 clang/test/SemaCXX/225792.cpp

diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index ec1f8077893eb3..09ef434cc54d82 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -4874,6 +4874,9 @@ ExprResult Sema::CheckVarOrConceptTemplateTemplateId(
     const TemplateArgumentListInfo *TemplateArgs) {
   TemplateTemplateParmDecl *Parameter =
       Template.getAsTemplateTemplateParmDecl();
+  if(!Parameter || Parameter->isInvalidDecl()){
+    return ExprError();
+  }
   assert(Parameter && "A variable template id without template?");
 
   if (Parameter->templateParameterKind() !=
diff --git a/clang/test/SemaCXX/225792.cpp b/clang/test/SemaCXX/225792.cpp
new file mode 100644
index 00000000000000..eec8be8c100d9f
--- /dev/null
+++ b/clang/test/SemaCXX/225792.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
+
+template <class T>
+concept C = true;
+
+template <template <class> concept... CC> // expected-error {{concept template 
parameter is a C++2c extension}}
+int foo(CC &) { return 42; } // expected-error {{expected 'auto' or 
'decltype(auto)' after concept name}} \
+                             // expected-note {{candidate template ignored: 
constraints not satisfied}}
+
+static_assert(foo<C>(0) == 42, ""); // expected-error {{no matching function 
for call to 'foo'}}
\ No newline at end of file

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to