[Bug c++/42844] New: const variable requires initializer / no explicitly declared default constructor

mathieu dot malaterre at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jan 22 11:27:00 GMT 2010


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



More information about the Gcc-bugs mailing list