[Bug c++/120335] Defining a function return type allowed with -pedantic-errors with using statement

2025-05-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120335

--- Comment #8 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #6)
> (In reply to eczbek.void from comment #5)
> > it seems to compile here: https://godbolt.org/z/dq51b7E3o
> 
> Oh inside a function, outside is not an issue.
> 
> But I suspect that is a different issue dealing with trailing return types
> and declarations inside a function. Let me file a seperate bug for that.

PR 120340 and yes it does look like a totally seperate issue as the variable is
not usable after invalid the trailing return type is used.

[Bug c++/120335] Defining a function return type allowed with -pedantic-errors with using statement

2025-05-18 Thread eczbek.void at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120335

--- Comment #7 from eczbek.void at gmail dot com ---
thanks!

[Bug c++/120335] Defining a function return type allowed with -pedantic-errors with using statement

2025-05-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120335

--- Comment #6 from Andrew Pinski  ---
(In reply to eczbek.void from comment #5)
> it seems to compile here: https://godbolt.org/z/dq51b7E3o

Oh inside a function, outside is not an issue.

But I suspect that is a different issue dealing with trailing return types and
declarations inside a function. Let me file a seperate bug for that.

[Bug c++/120335] Defining a function return type allowed with -pedantic-errors with using statement

2025-05-18 Thread eczbek.void at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120335

--- Comment #5 from eczbek.void at gmail dot com ---
it seems to compile here: https://godbolt.org/z/dq51b7E3o

[Bug c++/120335] Defining a function return type allowed with -pedantic-errors with using statement

2025-05-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120335

--- Comment #4 from Andrew Pinski  ---
(In reply to eczbek.void from comment #3)
> This also has the same issue:
> ```
> auto(*x)()->struct{};
> ```

That one fails for me as a parse error even without -pedantic:
```
:1:19: error: expected identifier before '{' token
1 | auto(*x)()->struct{};
  |   ^
```

[Bug c++/120335] Defining a function return type allowed with -pedantic-errors with using statement

2025-05-18 Thread eczbek.void at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120335

--- Comment #3 from eczbek.void at gmail dot com ---
This also has the same issue:
```
auto(*x)()->struct{};
```

[Bug c++/120335] Defining a function return type allowed with -pedantic-errors with using statement

2025-05-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120335

--- Comment #2 from Andrew Pinski  ---
Testcase:
```
using T = struct {}();
```

[Bug c++/120335] Defining a function return type allowed with -pedantic-errors with using statement

2025-05-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120335

Andrew Pinski  changed:

   What|Removed |Added

Summary|Defining a function return  |Defining a function return
   |type allowed with   |type allowed with
   |-pedantic-errors|-pedantic-errors with using
   ||statement
 Ever confirmed|0   |1
   Last reconfirmed||2025-05-18
  Known to fail||4.7.1
 Status|UNCONFIRMED |NEW

--- Comment #1 from Andrew Pinski  ---
Confirmed. Looks like GCC has incorrectly accepted this ever since the support
for  using type aliases back in GCC 4.7.0.

GCC does reject defining a new type as the return type with typedef and when
declaring a function. So it looks like an oversight here even.