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++/42844] New: const variable requires initializer / no explicitly declared default constructor


I believe the following c++ code is incorrect:

struct A
{
  A(){}
};

struct B : public A
{
};

int main()
{
  const B b;
  return 0;
}

It fails with Comeau with the following error:

"ComeauTest.c", line 13: error: const variable "b" requires an initializer --
class
          "B" has no explicitly declared default constructor
    const B b;


-- 
           Summary: const variable requires initializer / no explicitly
                    declared default constructor
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mathieu dot malaterre at gmail dot com


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


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