This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/50930] New: [C++0x] Valid brace-or-equal-initializer of non-static data member rejected
- From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 31 Oct 2011 07:46:14 +0000
- Subject: [Bug c++/50930] New: [C++0x] Valid brace-or-equal-initializer of non-static data member rejected
- Auto-submitted: auto-generated
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.