[clang] [Clang] skip warnings for constructors marked with the [[noreturn]] attribute (PR #115558)
Oleksandr T. via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 20 04:41:02 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
----------------
a-tarasyuk wrote:
> Can you also add a test case (in a different test file under SemaCXX) for:
>
>```cpp
>struct S {
> [[noreturn]] S();
>};
>
>int foo();
>int func() {
> S s;
> foo(); // Unreachable warning
>} // No "does not return a value" warning
>
>```
@AaronBallman thanks for the feedback. I briefly checked the issue yesterday, and the warning for this case appears at the end of the function. I'll take a closer look, maybe need to make some additional changes.
https://github.com/llvm/llvm-project/pull/115558
More information about the cfe-commits
mailing list