[Bug c++/103991] New: Bogus -Wreturn-type with constexpr if and local var with destructor

sbergman at redhat dot com gcc-bugzilla@gcc.gnu.org
Wed Jan 12 13:56:27 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103991

            Bug ID: 103991
           Summary: Bogus -Wreturn-type with constexpr if and local var
                    with destructor
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sbergman at redhat dot com
  Target Milestone: ---

Apparently a recent regression on GCC trunk:

> $ cat test.cc
> struct S { ~S(); };
> int f() {
>     S s;
>     if constexpr (true) return 0;
>     else return 0;
> }

> $ g++ -c test.cc
> test.cc: In function ‘int f()’:
> test.cc:6:1: warning: control reaches end of non-void function [-Wreturn-type]
>     6 | }
>       | ^


More information about the Gcc-bugs mailing list