[Bug c++/55082] New: c++11: default member constructor

lisp2d at lisp2d dot net gcc-bugzilla@gcc.gnu.org
Fri Oct 26 14:52:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55082

             Bug #: 55082
           Summary: c++11: default member constructor
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: lisp2d@lisp2d.net


In class definition default constructor for elements works only
by using {} notation.
 Operator = is not allowed.

bug.cpp:

class A{
int a{0}; // works
int b = 0; // works
public:
explicit  A(int x):a(x),b(x){}
};

class B{
A a{0}; // works
A b = 0;  // error: trying to use operator=
public:
explicit  B(int x):a(x),b(x){}
};

int main(int,char**){
  B b(1);
  return  0;}



More information about the Gcc-bugs mailing list