llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> They will just cause problems later when calling them. --- Full diff: https://github.com/llvm/llvm-project/pull/207157.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/Context.cpp (+2-1) - (modified) clang/test/AST/ByteCode/cxx23.cpp (+11-2) ``````````diff 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 `````````` </details> https://github.com/llvm/llvm-project/pull/207157 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
