http://llvm.org/bugs/show_bug.cgi?id=16056
Bug ID: 16056
Summary: std::atomic variables are never constant initialized
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
static std::atomic<..> variables are not properly constant initialized. If you
look at the assembly generated by clang for the following test case, you'll see
that testVar2 is not constant initialized to -1 as it should be.
#include <atomic>
int testVar1{-1};
std::atomic<int> testVar2{-1};
The following test case seems to suggest that this might be a problem with the
built-in _Atomic types:
struct TestVar {
_Atomic(int) value;
constexpr TestVar(int value) : value(value) {}
};
TestVar testVar{-1};
test.cpp:5:13: error: constexpr constructor never produces a constant
expression [-Winvalid-constexpr]
constexpr TestVar(int value) : value(value) {}
^
test.cpp:5:40: note: non-literal type '_Atomic(int)' cannot be used in a
constant expression
constexpr TestVar(int value) : value(value) {}
^
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs