[LLVMbugs] [Bug 14772] New: _Atomic types are not literal

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 1 13:31:30 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=14772

             Bug #: 14772
           Summary: _Atomic types are not literal
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: erik.olofsson at hansoft.se
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


This silently breaks std::atomic initialized with ATOMIC_VAR_INIT which is
initialized dynamically instead of statically.

Related to: http://llvm.org/bugs/show_bug.cgi?id=11612

testatomic.cpp:
struct AtomicInt
{
  _Atomic(int) Atomic;
};
AtomicInt GlobalAtomic0 = {0};
constexpr AtomicInt GlobalAtomic1 = {0};

clang -fsyntax-only -std=c++11 testatomic.cpp
testatomic.cpp:6:21: error: constexpr variable cannot have non-literal type
'const AtomicInt'
constexpr AtomicInt GlobalAtomic1 = {0};
                    ^
testatomic.cpp:3:16: note: 'AtomicInt' is not literal because it has data
member 'Atomic' of non-literal type '_Atomic(int)'
  _Atomic(int) Atomic;
               ^
1 error generated.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list