Small ChangeLog tweak.
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.law / init1.C
blobbdcc49434a4e647683982e5277a9cbebdc03fdcc
1 // { dg-do assemble  }
2 // { dg-prune-output "non-static data member initializers" }
3 // GROUPS passed initialization
4 class foo {
5 public:
6   int data;
7   foo(int dat) { data = dat; }
8 };
10 class bar {
11 public:
12   foo f[3] = { 1, 2, 3 };   // works: f[0] = 1, f[1] = 2, f[2] = 3 // { dg-error "" "" { target { ! c++11 } } } ANSI C++ forbids initialization of member f;
15 class bar2 {
16 public:
17       foo f[3] = { foo(1), foo(2), foo(3) }; // { dg-error "" "" { target { ! c++11 } } } ANSI C++ forbids initialization of member f;
18   // does not compile -- error: field initializer is not constant
21 int main(void)
23   foo f[3] = { foo(1), foo(2), foo(3) };
24   // standard C++ ... and it works too! :)
25   return 0;