diff options
Diffstat (limited to 'clang/test/SemaCXX/cxx2b-consteval-propagate.cpp')
-rw-r--r-- | clang/test/SemaCXX/cxx2b-consteval-propagate.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp b/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp index 6cf0e02..331fe83 100644 --- a/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp +++ b/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp @@ -626,3 +626,20 @@ void fn() { } } + + +namespace GH109096 { +consteval void undefined(); +template <typename T> +struct scope_exit { + T t; + constexpr ~scope_exit() { t(); } + // expected-error@-1 {{call to immediate function 'GH109096::(anonymous class)::operator()' is not a constant expression}} \ + // expected-note@-1 {{implicit use of 'this' pointer is only allowed within the evaluation}} +}; + +scope_exit guard( // expected-note {{in instantiation of member function}} + []() { undefined(); } +); + +} |