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++/55082] New: c++11: default member constructor


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;}


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