Barry wrote:
<code>
struct A {};
int main()
{
const A ca;
}
</code>
<output>
"ComeauTest.c", line 5: error: const variable "ca" requires an
initializer -- class
"A" has no explicitly declared default constructor
const A ca;
</output>
I don't find any thing in standard to support Comeau.
Look in [dcl.init]/9.
If it's a bug with Comeau, then it's quite silly.
If I was wrong, then I was doing this wrong all the time.
[dcl.init]/9:
"If no initializer is specified for an object, and the object is
of (possibly cv-qualified) non-POD class type (or array thereof),
the object shall be default-initialized; if the object is of
const-qualified type, the underlying class type shall have a user-
declared default constructor. Otherwise, if no initializer is
specified for a non-static object, the object and its subobjects,
if any, have an indeterminate initial value92); if the object or
any of its subobjects are of const-qualified type, the program is
ill-formed."
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask