[LLVMbugs] [Bug 11418] New: Non-static data member initializers not ignored in default copy constructor

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 21 15:14:09 PST 2011


             Bug #: 11418
           Summary: Non-static data member initializers not ignored in
                    default copy constructor
           Product: clang
           Version: unspecified
          Platform: All
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: williambbradley at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 7634
  --> http://llvm.org/bugs/attachment.cgi?id=7634
Test compilation file

In Apple clang version 3.0, 

When a non-static data member initializer exists, its value appears to be used
as that data member's "right-hand-side" in the default copy constructor
generated for the struct/class.  Currently the bug only repros for non-POD
structs, since PODs appear to be bitwise copied.  The attached files "test.cpp"
when compiled with the accompanying instructions in the comments, produces
varying output depending on whether the variable string1 is commented out or

According to Section 12.8.6 or the standard,

ยง 12.8:

-6. The implicitly-defined copy/move constructor for a non-union class X
performs a memberwise copy/move of its bases and members. [ Note:
brace-or-equal-initializers of non-static data members are ignored. ...] ...

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