Issue 168579
Summary [libc++] Accepts invalid `struct _Atomic(T)` because `_Atomic` expands to a class template
Labels libc++
Assignees
Reporter eisenwave
    https://godbolt.org/z/qeGE8YxzM
```cpp
#include <stdatomic.h>
struct _Atomic(int) x;
```

This code should raise an error (or warning), but is falsely accepted by Clang.

https://eel.is/c++draft/stdatomic.h.syn specifies _Atomic as expanding to an expositon-only *`std-atomic`* alias template. This forbids the use of a `struct` keyword.

The bug occurs because libc++ defines `_Atomic` along the lines of:

```cpp
#define _Atomic(_Tp) ::std::atomic<_Tp>
```

See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122738
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to