https://bugs.llvm.org/show_bug.cgi?id=37922
Bug ID: 37922
Summary: ISO C++ forbids declaration of '_Atomic' with no type
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: zhong...@pku.org.cn
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
The code is as follow:
struct AtomicInt
{
_Atomic(int) Atomic;
};
AtomicInt GlobalAtomic0 = {0};
constexpr AtomicInt GlobalAtomic1 = {0};
clang++ accepts the code, but g++ rejects the code:
code0.c.cpp:3:13: error: ISO C++ forbids declaration of '_Atomic' with no type
[-fpermissive]
_Atomic(int) Atomic;
^
code0.c.cpp:3:13: error: expected ';' at end of member declaration
_Atomic(int) Atomic;
^
;
code0.c.cpp:3:15: error: 'Atomic' does not name a type; did you mean
'AtomicInt'?
_Atomic(int) Atomic;
^~~~~~
AtomicInt
code0.c.cpp:5:29: error: too many initializers for 'AtomicInt'
AtomicInt GlobalAtomic0 = {0};
^
code0.c.cpp:6:39: error: too many initializers for 'const AtomicInt'
constexpr AtomicInt GlobalAtomic1 = {0};
This code looks ill-formed, right?
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs