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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [constexpr-static.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// Test for constant initialization of non-literal class (e.g. mutex)
2
// { dg-options "-std=c++0x -save-temps" }
3
// { dg-do run }
4
 
5
struct A
6
{
7
  int i;
8
  constexpr A(int _i): i(_i) { }
9
  A(const A&);                   // non-trivial copy ctor makes A non-literal
10
};
11
 
12
A a(42);            // constexpr constructor allows constant initialization
13
A ar[3] = { { 1 }, { 2 }, { 3 } };
14
// { dg-final { scan-assembler-not "static_initialization" } }
15
// { dg-final cleanup-saved-temps }
16
 
17
int main()
18
{
19
  if (a.i != 42
20
      || ar[0].i != 1
21
      || ar[1].i != 2
22
      || ar[2].i != 3)
23
    return 1;
24
}

powered by: WebSVN 2.1.0

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