FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.law / init1.C
blob1f23d78936d7deb5e3823999e109df7babb7c509
1 // Build don't link: 
2 // GROUPS passed initialization
3 class foo {
4 public:
5   int data;
6   foo(int dat) { data = dat; }
7 };
9 class bar {
10 public:
11   foo f[3] = { 1, 2, 3 };   // works: f[0] = 1, f[1] = 2, f[2] = 3 // ERROR - ANSI C++ forbids initialization of member f;
14 class bar2 {
15 public:
16       foo f[3] = { foo(1), foo(2), foo(3) }; // ERROR - ANSI C++ forbids initialization of member f;
17   // does not compile -- error: field initializer is not constant
20 int main(void)
22   foo f[3] = { foo(1), foo(2), foo(3) };
23   // standard C++ ... and it works too! :)
24   return 0;