[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 2 13:04:20 PDT 2022


aaron.ballman added a comment.

In D125919#3554310 <https://reviews.llvm.org/D125919#3554310>, @rjmccall wrote:

> Ah, yeah, that seems unrelated (and surprising).
>
> You think we're *not* supposed to drop `_Atomic` in a return type per C2x?  That seems surprising; I thought it was generally treated as a qualifier and would expect that we'd be supposed to drop it.

My first inclination was that it gets dropped as well because it's a qualifier and surely "unqualified" means drop all qualifiers... but the standard makes it far less clear (alas).

6.2.5p29 (types):
"Further, there is the _Atomic qualifier. The presence of the _Atomic qualifier designates an atomic
type. The size, representation, and alignment of an atomic type need not be the same as those of
the corresponding unqualified type. Therefore, this document explicitly uses the phrase "atomic,
qualified, or unqualified type" whenever the atomic version of a type is permitted along with the
other qualified versions of a type. The phrase "qualified or unqualified type", without specific
mention of atomic, does not include the atomic types."

Isn't that a gem? :-)

6.3.2.1p2 (lvalue conversion):
"... If the lvalue has qualified type, the value has the unqualified
version of the type of the lvalue; additionally, if the lvalue has
atomic type, the value has the non-atomic version of the type of the
lvalue. ..."

Which also gives a hint that _Atomic is special in terms of the phrase "unqualified".


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