https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/207157

They will just cause problems later when calling them.

>From a7d056aab674f36cf490758e33a803227771bf87 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]>
Date: Thu, 2 Jul 2026 12:39:34 +0200
Subject: [PATCH] asdf

---
 clang/lib/AST/ByteCode/Context.cpp |  3 ++-
 clang/test/AST/ByteCode/cxx23.cpp  | 13 +++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Context.cpp 
b/clang/lib/AST/ByteCode/Context.cpp
index 92a2ba57e08bf..4ca76ce3669d3 100644
--- a/clang/lib/AST/ByteCode/Context.cpp
+++ b/clang/lib/AST/ByteCode/Context.cpp
@@ -680,7 +680,8 @@ const Function *Context::getOrCreateFunction(const 
FunctionDecl *FuncDecl) {
     bool IsConst = PD->getType().isConstQualified();
     bool IsVolatile = PD->getType().isVolatileQualified();
 
-    if (!getASTContext().hasSameType(PD->getType(),
+    if (PD->isInvalidDecl() ||
+        !getASTContext().hasSameType(PD->getType(),
                                      FuncProto->getParamType(ParamIndex)))
       return nullptr;
 
diff --git a/clang/test/AST/ByteCode/cxx23.cpp 
b/clang/test/AST/ByteCode/cxx23.cpp
index ba7db75a589a1..5607ec9b59cb5 100644
--- a/clang/test/AST/ByteCode/cxx23.cpp
+++ b/clang/test/AST/ByteCode/cxx23.cpp
@@ -268,8 +268,11 @@ namespace ExplicitLambdaInstancePointer {
   };
   constexpr auto b = [](this K) { return 1; }; // all20-error {{explicit 
object parameters are incompatible with C++ standards before C++2b}} \
                                                // all-error {{unknown type 
name 'K'}}
-  constexpr int (*fp)(K) = b; // all-error {{unknown type name 'K'}}
-  static_assert(fp(1) == 1, ""); // expected-error {{not an integral constant 
expression}}
+  constexpr int (*fp)(K) = b; // all-error {{unknown type name 'K'}} \
+                              // expected-error {{must be initialized by a 
constant expression}} \
+                              // expected-note {{declared here}}
+  static_assert(fp(1) == 1, ""); // expected-error {{not an integral constant 
expression}} \
+                                 // expected-note {{initializer of 'fp' is not 
a constant expression}}
 }
 
 namespace TwosComplementShifts {
@@ -658,4 +661,10 @@ namespace BrokenShuffleVector {
   constexpr __m128 kf1{1.0f, 2.0f, 3.0f, 4.0f};
   constexpr __m128 v_mm_cvtps_pd = _mm_cvtps_pd(kf1); // all-error {{must be 
initialized by a constant expression}}
 }
+
+namespace BrokenExplicitInstanceParam {
+  auto b = [](this C) { return 1; }; // all-error {{unknown type name 'C'}}
+  static_assert( (&decltype(b)::operator())(1) == 1); // expected-error {{not 
an integral constant expression}}
+}
+
 #endif

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

Reply via email to