diff --git a/clang/test/AST/Interp/cxx23.cpp b/clang/test/AST/Interp/cxx23.cpp index d0991f3ffdff5e..b36299c3f8aeea 100644 --- a/clang/test/AST/Interp/cxx23.cpp +++ b/clang/test/AST/Interp/cxx23.cpp @@ -212,3 +212,14 @@ namespace VoidCast { static_assert(q == nullptr); // ref-error {{not an integral constant expression}} \ // ref-note {{initializer of 'q' is not a constant expression}} } + +namespace ExplicitLambdaInstancePointer { + struct C { + constexpr C(auto) { } + }; + void foo() { + constexpr auto b = [](this C) { return 1; }; // all20-error {{explicit object parameters are incompatible with C++ standards before C++2b}} + constexpr int (*fp)(C) = b; + static_assert(fp(1) == 1, ""); + } +} diff --git a/clang/test/AST/Interp/lambda.cpp b/clang/test/AST/Interp/lambda.cpp index c4fce283ec45a5..0eb12643b1b7f4 100644 --- a/clang/test/AST/Interp/lambda.cpp +++ b/clang/test/AST/Interp/lambda.cpp @@ -280,14 +280,3 @@ namespace InvalidCapture { } (); } } - -namespace ExplicitInstancePointer { - struct C { - constexpr C(auto) { } - }; - void foo() { - constexpr auto b = [](this C) { return 1; }; - constexpr int (*fp)(C) = b; - static_assert(fp(1) == 1, ""); - } -}