* [Bug c/114808] Qualified void return type is not diagnosed
2024-04-22 17:02 [Bug c/114808] New: Qualified void return type is not diagnosed luigighiron at gmail dot com
@ 2024-04-22 19:11 ` jakub at gcc dot gnu.org
2024-04-22 19:15 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-22 19:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114808
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I don't see such a sentence in C++17 nor other C++ standards.
All compilers I've tried accept it.
On the other side, e.g. http://eel.is/c++draft/basic.fundamental#15 talks about
functions returning cv void.
Similarly http://eel.is/c++draft/stmt.return#2
And
https://eel.is/c++draft/dcl.fct#14 explicitly says
"The return type shall be a non-array object type, a reference type, or cv
void."
This is something that was earlier said in [expr.call]/3 (e.g. in C++17,
[expr.call]/5 in C++20).
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/114808] Qualified void return type is not diagnosed
2024-04-22 17:02 [Bug c/114808] New: Qualified void return type is not diagnosed luigighiron at gmail dot com
2024-04-22 19:11 ` [Bug c/114808] " jakub at gcc dot gnu.org
@ 2024-04-22 19:15 ` pinskia at gcc dot gnu.org
2024-04-22 19:17 ` jakub at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-22 19:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114808
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #1)
> I don't see such a sentence in C++17 nor other C++ standards.
It was reported for C, not C++ :).
Anyways clang rejects it in C mode (with -pedantic-errors):
```
<source>:1:13: error: function cannot return qualified void type 'const void'
[-Werror,-Wqualified-void-return-type]
1 | const void f(void){}
| ^
```
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/114808] Qualified void return type is not diagnosed
2024-04-22 17:02 [Bug c/114808] New: Qualified void return type is not diagnosed luigighiron at gmail dot com
2024-04-22 19:11 ` [Bug c/114808] " jakub at gcc dot gnu.org
2024-04-22 19:15 ` pinskia at gcc dot gnu.org
@ 2024-04-22 19:17 ` jakub at gcc dot gnu.org
2024-04-22 19:34 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-22 19:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114808
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Oops, I'm blind.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/114808] Qualified void return type is not diagnosed
2024-04-22 17:02 [Bug c/114808] New: Qualified void return type is not diagnosed luigighiron at gmail dot com
` (2 preceding siblings ...)
2024-04-22 19:17 ` jakub at gcc dot gnu.org
@ 2024-04-22 19:34 ` pinskia at gcc dot gnu.org
2024-04-22 19:42 ` luigighiron at gmail dot com
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-22 19:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114808
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-04-22
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. clang added the warning/error back in 2015 ...
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/114808] Qualified void return type is not diagnosed
2024-04-22 17:02 [Bug c/114808] New: Qualified void return type is not diagnosed luigighiron at gmail dot com
` (3 preceding siblings ...)
2024-04-22 19:34 ` pinskia at gcc dot gnu.org
@ 2024-04-22 19:42 ` luigighiron at gmail dot com
2024-04-22 19:46 ` luigighiron at gmail dot com
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: luigighiron at gmail dot com @ 2024-04-22 19:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114808
--- Comment #5 from Halalaluyafail3 <luigighiron at gmail dot com> ---
I made this bug report because of the warning that clang has, but the following
paragraph may allow this:
> If, in the declaration "T D1", D1 has the form
> D ( parameter-type-list )
> or
> D ( identifier-list opt )
> and the type specified for ident in the declaration "T D" is
> "derived-declarator-type-list T", then the type specified for
> ident is "derived-declarator-type-list function returning the
> unqualified version of T".
Section 6.7.6.3 "Function declarators (including prototypes)" Paragraph 4
ISO/IEC 9899:2018
GCC seems to be using this to not make a diagnostic here, e.g. it warns with a
return type of _Atomic void in C17 mode but not in C23 mode where the text here
was updated to indicate that the result is the unqualified and non-atomic
version of T. If this would make the text talking about the return type of the
function refer to the unqualified return type then this should be allowed I
think, and I will make a bug report to clang to get this diagnostic changed.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/114808] Qualified void return type is not diagnosed
2024-04-22 17:02 [Bug c/114808] New: Qualified void return type is not diagnosed luigighiron at gmail dot com
` (4 preceding siblings ...)
2024-04-22 19:42 ` luigighiron at gmail dot com
@ 2024-04-22 19:46 ` luigighiron at gmail dot com
2024-04-22 19:54 ` jsm28 at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: luigighiron at gmail dot com @ 2024-04-22 19:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114808
--- Comment #6 from Halalaluyafail3 <luigighiron at gmail dot com> ---
* Paragraph 5 instead of Paragraph 4
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/114808] Qualified void return type is not diagnosed
2024-04-22 17:02 [Bug c/114808] New: Qualified void return type is not diagnosed luigighiron at gmail dot com
` (5 preceding siblings ...)
2024-04-22 19:46 ` luigighiron at gmail dot com
@ 2024-04-22 19:54 ` jsm28 at gcc dot gnu.org
2024-04-22 20:11 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2024-04-22 19:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114808
--- Comment #7 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
Yes, this is deliberate following the resolution of DR#423 which means
qualifiers are ignored on function return types (it's still diagnosed in
pre-C11 modes).
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/114808] Qualified void return type is not diagnosed
2024-04-22 17:02 [Bug c/114808] New: Qualified void return type is not diagnosed luigighiron at gmail dot com
` (6 preceding siblings ...)
2024-04-22 19:54 ` jsm28 at gcc dot gnu.org
@ 2024-04-22 20:11 ` pinskia at gcc dot gnu.org
2024-04-23 1:12 ` luigighiron at gmail dot com
2024-04-23 5:54 ` xry111 at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-22 20:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114808
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://github.com/llvm/llvm-project/issues/39494 is the clang issue dealing
with DR 423 .
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/114808] Qualified void return type is not diagnosed
2024-04-22 17:02 [Bug c/114808] New: Qualified void return type is not diagnosed luigighiron at gmail dot com
` (7 preceding siblings ...)
2024-04-22 20:11 ` pinskia at gcc dot gnu.org
@ 2024-04-23 1:12 ` luigighiron at gmail dot com
2024-04-23 5:54 ` xry111 at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: luigighiron at gmail dot com @ 2024-04-23 1:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114808
Halalaluyafail3 <luigighiron at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #9 from Halalaluyafail3 <luigighiron at gmail dot com> ---
Resolving since I feel that the current behavior here is correct after looking
at the text in the standard enough. -Wignored-qualifiers also seems to cover
this case so adding a new warning shouldn't be needed either.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/114808] Qualified void return type is not diagnosed
2024-04-22 17:02 [Bug c/114808] New: Qualified void return type is not diagnosed luigighiron at gmail dot com
` (8 preceding siblings ...)
2024-04-23 1:12 ` luigighiron at gmail dot com
@ 2024-04-23 5:54 ` xry111 at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: xry111 at gcc dot gnu.org @ 2024-04-23 5:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114808
Xi Ruoyao <xry111 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |xry111 at gcc dot gnu.org
Resolution|FIXED |INVALID
--- Comment #10 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
So this is not a valid bug report considering DR 423.
^ permalink raw reply [flat|nested] 11+ messages in thread