This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/42844] New: const variable requires initializer / no explicitly declared default constructor
- From: "mathieu dot malaterre at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Jan 2010 11:27:22 -0000
- Subject: [Bug c++/42844] New: const variable requires initializer / no explicitly declared default constructor
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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