[LLVMbugs] [Bug 13064] New: non-static member initialisation invokes copy-constructor in template classes

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jun 9 04:54:08 PDT 2012


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

             Bug #: 13064
           Summary: non-static member initialisation invokes
                    copy-constructor in template classes
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: killiands at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Consider following minimal code samples:

#include <atomic>
struct simple { std::atomic_bool b {false}; };
int main() { simple s; }

and

#include <atomic>
template<class T>
struct simple { std::atomic_bool b {false}; };
int main() { simple<void> s; }

While there is no difference between both initialisations of atomic_bool, the
second code sample fails to compile with following errors:

test.cpp:3:37: error: copying member subobject of type 'std::atomic_bool'
invokes deleted constructor
struct simple { std::atomic_bool b {false}; };
                                    ^~~~~
test.cpp:4:27: note: in instantiation of template class 'simple<void>'
requested here
int main() { simple<void> s; }
                          ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/atomic:61:5:
note: function has been explicitly marked deleted here
    atomic_bool(const atomic_bool&) = delete;
    ^
1 error generated.


clang version:

clang++ -v
Debian clang version 3.1-3eudoxos1 (branches/release_31) (based on LLVM 3.1)
Target: x86_64-pc-linux-gnu
Thread model: posix

-- 
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