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]

Re: Buggy test 20_util/exchange/1.cc


On 15 October 2013 17:57, Diego Novillo wrote:
> 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?

Yes sure, thanks.

FWIW, the test came from an example in the proposal:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3668.html


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