This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Buggy test 20_util/exchange/1.cc
- From: Diego Novillo <dnovillo at google dot com>
- To: "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Tue, 15 Oct 2013 09:57:55 -0700
- Subject: Buggy test 20_util/exchange/1.cc
- Authentication-results: sourceware.org; auth=none
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.