[PATCH] D125919: Drop qualifiers from return types in C (DR423)

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 9 05:24:47 PDT 2022


aaron.ballman added a comment.

In D125919#3560523 <https://reviews.llvm.org/D125919#3560523>, @aaron.ballman wrote:

> All that said, I think you can see why I'm hoping to get an answer from WG14 as to what to do. Reasonable folks are disagreeing on what the standard requires here.

The discussion on the WG14 reflector seems to be settling down to a consensus position that the `_Atomic` qualifier is only syntactically a qualifier and its use designates an entirely new type. When the standard says "unqualified type", the `_Atomic` is not considered a qualification. So we should *not* be stripping the `_Atomic` as I was doing in this patch. (SC22WG14.22200 has most of the details spelled out nicely, if you have access to the reflectors.)

I had asked other questions in related areas that also got answers.

`const void func(volatile void);` -- the return type is adjusted to `void`; the parameter type is UB (by lack of specification) and we can do what we want here. We currently diagnose the parameter as being invalid: https://godbolt.org/z/9c8bTrerY. Our behavior with the parameter is consistent with GCC and EDG.

`const int main(void)` -- this is valid and equivalent to `int main(void)`, so it should be accepted; we currently reject: https://godbolt.org/z/v43h596ev

`const int func(void); int func(void) { }` -- this is DR423. It is valid, the composite type is `int(void)`; we give a conflicting types error: https://godbolt.org/z/Yb841r7Ex


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125919/new/

https://reviews.llvm.org/D125919



More information about the cfe-commits mailing list