OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.law/] [init1.C] - Blame information for rev 699

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { 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
};
9
 
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++98 } } ANSI C++ forbids initialization of member f;
13
};
14
 
15
class bar2 {
16
public:
17
      foo f[3] = { foo(1), foo(2), foo(3) }; // { dg-error "" "" { target c++98 } } ANSI C++ forbids initialization of member f;
18
  // does not compile -- error: field initializer is not constant
19
};
20
 
21
int main(void)
22
{
23
  foo f[3] = { foo(1), foo(2), foo(3) };
24
  // standard C++ ... and it works too! :)
25
  return 0;
26
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.