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