Skip to content

Non-static data member initializers not ignored in default copy constructor #11790

@wbbradley

Description

@wbbradley
mannequin
Bugzilla Link 11418
Resolution FIXED
Resolved on Nov 28, 2011 14:03
Version unspecified
OS MacOS X
Attachments Test compilation file
CC @DougGregor

Extended Description

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++11

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions