[Bug c++/19246] New: Cannot instansate const struct without constructor.
chris at bubblescope dot net
gcc-bugzilla@gcc.gnu.org
Mon Jan 3 22:53:00 GMT 2005
The following code fails to compile. I believe (although I'm not positive) it
should:
struct S {};
const S s;
Notes:
The code doesn't compile with "struct S {int i;};", so the problem isn't an
empty struct.
The following variants do compile:
struct S{ S(){} };
const S s;
struct S {};
const S s = S();
Note that:
struct S {};
const S s();
does compile, but doesn't declare s as an S, but as a void function returning
const S.
This does compile in vc++7.1 (not that that means it's right!)
PS Yes I realise this construct is almost entirely useless, I came across it
while writing a testcase.
--
Summary: Cannot instansate const struct without constructor.
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: chris at bubblescope dot net
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19246
More information about the Gcc-bugs
mailing list