Skip to content

invalid defaulted copy constructor if a member is const #10994

@llvmbot

Description

@llvmbot
Bugzilla Link 10622
Resolution FIXED
Resolved on Aug 10, 2011 11:52
Version unspecified
OS Linux
Reporter LLVM Bugzilla Contributor
CC @DougGregor

Extended Description

Sorry if this is one of the "know to be missing" items, but there seems to be quiet a bit of support for "= default" already.

Clang complains when compiling

struct foo {
const int first;
constexpr foo(const foo&) = default;
};
void find_or_insert(const foo& __obj) {
foo x(__obj);
}

the error is

path_service.ii:3:13: error: constructor for 'foo' must explicitly initialize the const member 'first'
constexpr foo(const foo&) = default;
^
path_service.ii:2:13: note: declared here
const int first;
^
path_service.ii:6:7: note: implicit default copy constructor for 'foo' first required here
foo x(__obj);
^

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