[clang] [Clang] skip warnings for constructors marked with the [[noreturn]] attribute (PR #115558)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 19 04:51:07 PST 2024


================
@@ -49,3 +49,15 @@ void check() {
   test_type(g);
   test_type(h); // expected-note {{instantiation}}
 }
+
+namespace GH63009 {
+struct S {
+  [[noreturn]] S() { throw int {}; }
+};
+
+int test_no_return_constructor() { S(); } // ok
----------------
AaronBallman wrote:

Also, since we're here, can you add a test to ensure that destructors also work as expected? That can be done in a separate PR if you'd like.

https://github.com/llvm/llvm-project/pull/115558


More information about the cfe-commits mailing list