-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Closed as not planned
Closed as not planned
Copy link
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++11clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"invalidResolved as invalid, i.e. not a bugResolved as invalid, i.e. not a bug
Description
| Bugzilla Link | 27052 |
| Version | 3.7 |
| OS | Linux |
| Reporter | LLVM Bugzilla Contributor |
| CC | @DougGregor |
Extended Description
I am getting an error when compiling the following snippet:
struct Explicit {
explicit Explicit() {}
};
struct A {
A(): _a{} {}
Explicit _a[5];
};
int main() {}Clang 3.7.1 complains that error: chosen constructor is explicit in copy-initialization, both GCC 5.3 and MSVC 2015 compile fine. The behavior differs when I make the following changes:
- If I remove the
explicitkeyword, it compiles fine (of course). - If I make the
_amember a non-array, it compiles fine. - If I change
_a{}to the C++03-style_a(), it compiles fine. - If I change
_a{}to_a{Explicit{}, Explicit{}, Explicit{}, Explicit{}, Explicit{}}, it compiles fine. - If I change the constructor to
explicit Explicit() = default;, it compiles fine.
The problem is not just when using constructor initializer lists, but also when initializing the array as a variable like this:
Explicit b[5]{};This behavior seems rather arbitrary to me and since the "old" C++03-style works okay, I think it should have the same behavior in C++11.
This probably affects also older versions, didn't have a chance to test.
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++11clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"invalidResolved as invalid, i.e. not a bugResolved as invalid, i.e. not a bug