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

Subversion Repositories openrisc

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

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
// 4.5.3 constant expressions
7
 
8
// p 4
9
struct A {
10
  constexpr A(int i) : val(i) { }
11
  constexpr operator int() { return val; }
12
  constexpr operator long() { return -1; }
13
private:
14
  int val;
15
};
16
 
17
template struct X { static const int i = I; };
18
constexpr A a = 42;
19
 
20
X x;        // OK: unique conversion to int
21
int ar[X::i]; // also OK
22
int ary[a]; // { dg-error "ambiguous|conversion|array" } ambiguous conversion
23
 

powered by: WebSVN 2.1.0

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