================ @@ -16,6 +17,16 @@ void throwError(const std::string& msg) { // expected-warning {{function 'throwE throw std::runtime_error(msg); } +// We cannot use the [[noreturn]] attribute on lambdas until C++23 +void lambda(const std::string& msg) { +#if __cplusplus >= 202302L + auto l1 = [&msg](){ throw std::runtime_error(msg); }; // expected-warning {{function 'operator()' could be declared with attribute 'noreturn'}} + auto l2 = [&msg] [[noreturn]] (){ throw std::runtime_error(msg); }; ---------------- zwuis wrote:
Clang supports attributes here as languge extension before C++23. You can enable this test before C++23, and, disable the language extension warning or verify the warning is emitted. https://github.com/llvm/llvm-project/pull/154545 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits