mkovacevic99 wrote: > Background: `__auto_type` is a GCC extension, but it's closely related to > `auto` in C23. In C23, `auto` is not a type specifier, it's the use as a > storage class specifier along with the _lack_ of a type specifier that > triggers the type inference in C23. So that means: > > ``` > // Okay, `_Atomic` is a *qualifier* so this is a qualifier and a storage > class specifier with no type specifier > _Atomic auto i = 12; > // Invalid, `_Atomic` is a *type specifier* this way. > _Atomic(auto) j = 12; > ``` > > and GCC is faithfully implementing this: https://godbolt.org/z/ef81jzro1 and > their implementation of `__auto_type` does the same: > https://godbolt.org/z/ajsPhdWz4 > > However, it was known at the time `auto` was adopted into C23 that WG14 > wanted to make it an actual type specifier, it wasn't done initially due to > timing of the standard release. C2y has been making progress towards that > change: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3579.htm but > Clang's implementation predates any WG14 debates on what it means for `auto` > as a type specifier. So Clang's implementation is not the same as GCC's, we > do not distinguish between `_Atomic` as a qualifier and `_Atomic` as a > specifier; both form an `AtomicType`, so Clang treats `_Atomic auto` and > `_Atomic(auto)` the same: https://godbolt.org/z/9en1Ee8TE because we were > thinking there's no good reason to want them to behave so differently. > However, the paper explicitly calls this difference out and does not attempt > to change it so perhaps we should follow GCC now. > > So I suspect there's two issues here, one is the crash being fixed but the > other is that we don't handle the qualifier version correctly (that doesn't > need to be addressed in this PR but we should make sure we've got an issue > filed for it).
can you maybe open a separate issue for the second part? I think it's better to address it as a separate PR https://github.com/llvm/llvm-project/pull/197874 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
