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

Subversion Repositories openrisc

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

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do compile }
2
// { dg-options "-std=gnu++0x" }
3
 
4
// From N2235
5
 
6
// 1
7
struct A2
8
{
9
  static const int eights = 888;
10
  static constexpr int nines = 999;
11
};
12
 
13
A2 a;
14
 
15
// 2
16
struct pixel
17
{
18
  int x, y;
19
};
20
constexpr pixel ur = { 1294, 1024 }; // OK
21
 
22
// p4
23
struct Length
24
{
25
   explicit constexpr Length(int i = 0) : val(i) { }
26
private:
27
   int val;
28
};
29
 
30
constexpr int myabs(int x)
31
{ return x < 0 ? -x : x; }    // OK
32
 
33
Length l(myabs(-97)); // OK
34
 
35
// p6
36
class debug_flag
37
{
38
public:
39
   explicit debug_flag(bool);
40
   constexpr bool is_on(); // { dg-error "enclosing class .* not a literal type" }
41
private:
42
   bool flag;
43
};

powered by: WebSVN 2.1.0

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