Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/template/const1.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
// PR c++/28385 // instantiating op() with void()() was making the compiler think that 'fcn' // was const, so it could eliminate the call. // { dg-do run } extern "C" void abort (void); int barcnt = 0; class Foo { public: template<typename T> void operator()(const T& fcn) { fcn(); } }; void bar() { barcnt++; } int main() { Foo myFoo; myFoo(bar); myFoo(&bar); if (barcnt != 2) abort (); return 0; }