This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Buggy test 20_util/exchange/1.cc


This test fails to link unless compiled with -O2. The compiler is
eliding the whole body of test03(), so everything links and runs
properly.

// Deduce type of overloaded function
void
test03()
{
  bool test __attribute__((unused)) = true;
  int (*fp)(int);  int f(int);
  double f(double);
  std::exchange(fp, &f);
  VERIFY( fp != nullptr );
}

However, at -O0, the address of f() is really needed, so we fail to link.

This test really needs an empty f() function.  Would such a patch be OK?


Thanks.  Diego.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]