[LLVMbugs] [Bug 24114] New: std::atomic for non-Clang is not a literal type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jul 13 17:52:34 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24114

            Bug ID: 24114
           Summary: std::atomic for non-Clang is not a literal type
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: thiago at kde.org
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

Source code:
 constexpr std::atomic<int> i = { 42 };

This fails to compile because the __gcc_atomic struct's value constructor is
missing constexpr. Please add it.

Compilation error with ICC 14.0 on OS X with the libc++ from XCode 6.4 (I don't
know how to obtain the exact version of libc++):

Line 1: error: expression must have a constant value
  extern constexpr std::atomic<int> i{ 42 };
                                     ^

Compilation errors (trimmed) with GCC 4.9 on Linux with libc++ from trunk as of
r242056:

error: the type ‘const std::__1::atomic<int>’ of constexpr variable ‘i’ is not
literal
atomic:996:8: note: ‘std::__1::atomic<int>’ is not literal because:
atomic:996:8: note:   base class ‘std::__1::__atomic_base<int, true>’ of
‘std::__1::atomic<int>’ is non-literal
atomic:915:8: note: ‘std::__1::__atomic_base<int, true>’ is not literal
because:
atomic:915:8: note:   base class ‘std::__1::__atomic_base<int, false>’ of
‘std::__1::__atomic_base<int, true>’ is non-literal
atomic:820:8: note: ‘std::__1::__atomic_base<int, false>’ is not literal
because:
atomic:822:26: note:   non-static data member ‘std::__1::__atomic_base<int,
false>::__a_’ has non-literal type
atomic:555:8: note: ‘std::__1::__gcc_atomic::__gcc_atomic_t<int>’ is not
literal because:
atomic:555:8: note:   ‘std::__1::__gcc_atomic::__gcc_atomic_t<int>’ is not an
aggregate, does not have a trivial default constructor, and has no constexpr
constructor that is not a copy or move constructor

-- 
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/20150714/7d6a567a/attachment.html>


More information about the llvm-bugs mailing list