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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [template/] [const1.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
// PR c++/28385
2
// instantiating op() with void()() was making the compiler think that 'fcn'
3
// was const, so it could eliminate the call.
4
 
5
// { dg-do run }
6
 
7
extern "C" void abort (void);
8
 
9
int barcnt = 0;
10
 
11
class Foo {
12
  public:
13
    template
14
    void operator()(const T& fcn) {
15
      fcn();
16
    }
17
};
18
 
19
void bar() {
20
  barcnt++;
21
}
22
 
23
int main() {
24
  Foo myFoo;
25
  myFoo(bar);
26
  myFoo(&bar);
27
  if (barcnt != 2)
28
    abort ();
29
  return 0;
30
}

powered by: WebSVN 2.1.0

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