Member initialization of arrays of constants
Michael Schwendt
mschwendt@web.de
Wed Aug 9 14:57:00 GMT 2000
Hi!
After a discussion on comp.std.c++ and quite some time spent on
reading the Standard and Bjarne Stroustrup's book, I feel sort of
brain-washed and tend to believe that this code must not compile
without errors because struct A contains uninitialized const members
that either require a constructor or cannot be initialized
explicitly:
struct A
{
const char c[4]; // ill-formed
const int i; // requires constructor
};
class C
{
static const A a;
};
const A C::a = { 'T','E','S','T', 2 }; // error! struct A is bad
In Stroustrup's "C++ Programming Language" 3rd Edition, see:
10.4.2
10.4.6.1
10.4.6.2
In the C++ Standard see:
8.5/9
9/4
9.2/4
9.2/5
Conclusively,
Regards,
Mike
--
"I don't need luck. I got a system. I play all the odd red numbers."
- Danny Wilde (The Persuaders!)
More information about the Gcc-bugs
mailing list