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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2025-04-15
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, it has to do with the return type needing to be a dependent.

Take:
```
void a(...);

template<typename T = void, T (*v)(...) = a>
bool b1()
{  return requires { v(v(1)); }; }
bool c() { return b1(); }
```

GCC has a return value of 1 here while it should be 0.

Also take:
```
void a(...);

template<typename T = void, void (*v)(...) = a>
bool b1()
{  return requires { v(v(1)); }; }
bool c() { return b1(); }
```

clang/MSVC accepts this has a return value of 0 while GCC rejects this saying:
```
<source>: In function 'bool b1()':
<source>:5:25: error: void value not ignored as it ought to be
[-Wtemplate-body]
    5 | {  return requires { v(v(1)); }; }
      |                        ~^~~
```

Reply via email to