[LLVMbugs] [Bug 16056] New: std::atomic variables are never constant initialized
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri May 17 09:15:03 PDT 2013
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: unassignedclangbugs at nondot.org
Reporter: st at quanttec.com
CC: llvmbugs at cs.uiuc.edu
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130517/20ef5c48/attachment.html>
More information about the llvm-bugs
mailing list