[Bug c++/50930] New: [C++0x] Valid brace-or-equal-initializer of non-static data member rejected
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Mon Oct 31 07:46:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50930
Bug #: 50930
Summary: [C++0x] Valid brace-or-equal-initializer of non-static
data member rejected
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: daniel.kruegler@googlemail.com
CC: jason@redhat.com
gcc 4.7.0 20111029 (experimental) in C++0x mode rejects the following code
//---
struct nmc {
nmc() = default;
nmc(nmc&&) = delete; // line 3
};
struct A { // line 6
nmc n{};
} a; // line 8
//---
"
In constructor 'constexpr A::A()':
6|error: use of deleted function 'nmc::nmc(nmc&&)'
3|error: declared here
8|note: synthesized method 'constexpr A::A()' first required here
"
It seems that the compiler introduces here a copy-initialization while
initializing the member nmc in the default constructor, but the semantics of
the brace-or-equal-initializer don't allow this as described by 12.6.2 p8 and
8.5.
More information about the Gcc-bugs
mailing list