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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [template/] [const1.C] - Diff between revs 149 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
// PR c++/28385
// PR c++/28385
// instantiating op() with void()() was making the compiler think that 'fcn'
// instantiating op() with void()() was making the compiler think that 'fcn'
// was const, so it could eliminate the call.
// was const, so it could eliminate the call.
// { dg-do run }
// { dg-do run }
extern "C" void abort (void);
extern "C" void abort (void);
int barcnt = 0;
int barcnt = 0;
class Foo {
class Foo {
  public:
  public:
    template
    template
    void operator()(const T& fcn) {
    void operator()(const T& fcn) {
      fcn();
      fcn();
    }
    }
};
};
void bar() {
void bar() {
  barcnt++;
  barcnt++;
}
}
int main() {
int main() {
  Foo myFoo;
  Foo myFoo;
  myFoo(bar);
  myFoo(bar);
  myFoo(&bar);
  myFoo(&bar);
  if (barcnt != 2)
  if (barcnt != 2)
    abort ();
    abort ();
  return 0;
  return 0;
}
}
 
 

powered by: WebSVN 2.1.0

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