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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [constexpr-ptrmem.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
struct C { // literal type
4
  int m;
5
  int n;
6
  constexpr C(int m) : m(m), n(-m) {}
7
  constexpr bool is_neg() { return m < 0; }
8
};
9
 
10
constexpr bool check1(const C& c, int C:: *pm) { return c.*pm < 0; } // #1
11
 
12
constexpr bool check2(const C* pc, bool (C::*pm)() const) { return
13
(pc->*pm)(); } // #2
14
 
15
constexpr C c(-1);
16
 
17
static_assert(!check1(c, &C::n), "Error");
18
static_assert(check1(c, &C::m), "Error");
19
 
20
static_assert(check2(&c, &C::is_neg), "Error");

powered by: WebSVN 2.1.0

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