OSDN Git Service
(root)
/
pf3gnuchains
/
gcc-fork.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
/cp
[pf3gnuchains/gcc-fork.git]
/
gcc
/
testsuite
/
g++.dg
/
template
/
const1.C
1
// 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<typename T>
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
}