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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [static_assert2.C] - Blame information for rev 320

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

Line No. Rev Author Line
1 301 jeremybenn
// { dg-options "-std=c++0x" }
2
template
3
struct accept_evens {
4
  static_assert( I % 2 == 0, "I must be an even number"); // { dg-error "even number" }
5
};
6
 
7
template
8
struct accept_evens_ok {
9
  static_assert( I % 2 == 0, "I must be an even number");
10
};
11
 
12
template
13
void accept_odds() {
14
  static_assert( I % 2 == 1, "I must be an odd number"); // { dg-error "odd number" }
15
}
16
 
17
template
18
void accept_odds_ok() {
19
  static_assert( I % 2 == 1, "I must be an odd number");
20
}
21
 
22
void f()
23
{
24
  accept_odds<1>();
25
  accept_odds<2>();
26
  accept_odds<3>();
27
  accept_odds_ok<5>();
28
  accept_odds_ok<7>();
29
}
30
 
31
accept_evens<0> ok0;
32
accept_evens<1> error1;
33
accept_evens<2> ok2;
34
accept_evens_ok<4> ok4;
35
accept_evens_ok<6> ok6;

powered by: WebSVN 2.1.0

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