OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.law/] [init1.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do assemble  }
2
// GROUPS passed initialization
3
class foo {
4
public:
5
  int data;
6
  foo(int dat) { data = dat; }
7
};
8
 
9
class bar {
10
public:
11
  foo f[3] = { 1, 2, 3 };   // works: f[0] = 1, f[1] = 2, f[2] = 3 // { dg-error "" } ANSI C++ forbids initialization of member f;
12
};
13
 
14
class bar2 {
15
public:
16
      foo f[3] = { foo(1), foo(2), foo(3) }; // { dg-error "" } ANSI C++ forbids initialization of member f;
17
  // does not compile -- error: field initializer is not constant
18
};
19
 
20
int main(void)
21
{
22
  foo f[3] = { foo(1), foo(2), foo(3) };
23
  // standard C++ ... and it works too! :)
24
  return 0;
25
}

powered by: WebSVN 2.1.0

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