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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [constexpr-ex3.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-options "-std=c++0x" }
2
 
3
#define SA(X) static_assert (X, #X)
4
 
5
struct A
6
{
7
  int i;
8
  constexpr A(int _i) { i = _i; } // { dg-error "empty body|uninitialized member" }
9
};
10
 
11
template 
12
struct B
13
{
14
  T t;
15
  constexpr B(T _t): t(_t) { }
16
};
17
 
18
B b(1);                // { dg-message "not declared .constexpr" }
19
SA(b.t==1);                     // { dg-error "non-constant condition|'b'" }
20
constexpr B b2(1);
21
SA(b2.t==1);
22
 
23
template 
24
constexpr T f(T a, T b)
25
{
26
  typedef T myT;
27
  return a + b;
28
}
29
 
30
SA(f(1,2)==3);

powered by: WebSVN 2.1.0

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