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

            Bug ID: 103929
           Summary: False warning: no return statement in function
                    returning non-void
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

In the following program:
```
template<auto>
struct A{};

template<class = A<[]{}>>
struct B { using X = B<>; };

B<int> x;
```
compiled with `-std=c++20 -Wall -Wextra -pedantic-errors` flags, GCC prints
false warning:
```
warning: no return statement in function returning non-void [-Wreturn-type]
    4 | template<class = A<[]{}>>
      |                    ^~~~
```
Demo: https://gcc.godbolt.org/z/bjrs5vMhj

But actually `[]{}` is a lambda returning void, so no return statement is
necessary.

Reply via email to