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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// { dg-options -std=c++0x }
2
 
3
template
4
struct IsNegative {
5
  int dummy; // Workaround for empty class problem
6
  constexpr IsNegative() : dummy(0) {}
7
  constexpr bool operator()(const T& x) {
8
    return x < T(0);
9
  }
10
};
11
 
12
template
13
constexpr bool has_neg(T (&x)[N], Pred p) {
14
  return p(x[0]) || p(x[1]);
15
}
16
 
17
constexpr int a[] = {1, -2};
18
 
19
constexpr auto answer = has_neg(a, IsNegative{}); // #1
20
 
21
static_assert(answer, "Error");

powered by: WebSVN 2.1.0

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