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-ptr4.C] - Blame information for rev 715

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
constexpr const int do_last(const int* x, int n) {
4
 return x[n - 1];
5
}
6
 
7
struct IsNegative {
8
  constexpr bool operator()(const int& x) {
9
    return x < 0;
10
  }
11
};
12
 
13
template
14
constexpr bool has_neg(const int (&x)[N], Pred p) {
15
  return p(do_last(x, N)); // Line 13
16
}
17
 
18
constexpr int a[] = {1, -2};
19
 
20
constexpr auto answer = has_neg(a, IsNegative{}); // Line 18
21
 
22
static_assert(answer, "Error");
23
 

powered by: WebSVN 2.1.0

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