This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/50930] New: [C++0x] Valid brace-or-equal-initializer of non-static data member rejected


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]