diff mbox series

[testsuite] Fix -Wreturn-type fallout in g++.dg/cpp0x/rv-trivial-bug.C on Solaris 10

Message ID yddvaid2m3f.fsf@CeBiTec.Uni-Bielefeld.DE
State New
Headers show
Series [testsuite] Fix -Wreturn-type fallout in g++.dg/cpp0x/rv-trivial-bug.C on Solaris 10 | expand

Commit Message

Rainer Orth Nov. 14, 2017, 10:25 a.m. UTC
Currently, g++.dg/cpp0x/rv-trivial-bug.C FAILs on Solaris 10 only:

+FAIL: g++.dg/cpp0x/rv-trivial-bug.C  -std=c++11 (test for excess errors)
+FAIL: g++.dg/cpp0x/rv-trivial-bug.C  -std=c++14 (test for excess errors)

/vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/cpp0x/rv-trivial-bug.C:27:1: warning: no return statement in function returning non-void [-Wreturn-type]

This happens as follows: the last assert() in test2() expands to

   (void)((
   move_assign == 1
   ) || (__assert_c99(
   "move_assign == 1"
   , "/vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/cpp0x/rv-trivial-bug.C", 26, __func__), 0))

and unlike the Solaris 11 <assert.h>, the Solaris 10 one doesn't mark
__assert_c99 as noreturn.  Fixed by adding a return value.  Tested with
the appropriate runtest invocation on i386-pc-solaris2.10,
i386-pc-solaris2.11, and x86_64-pc-linux-gnu.

Will commit shortly unless someone objects.

	Rainer
diff mbox series

Patch

diff --git a/gcc/testsuite/g++.dg/cpp0x/rv-trivial-bug.C b/gcc/testsuite/g++.dg/cpp0x/rv-trivial-bug.C
--- a/gcc/testsuite/g++.dg/cpp0x/rv-trivial-bug.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv-trivial-bug.C
@@ -24,6 +24,7 @@  int test2()
     assert(move_assign == 0);
     b = static_cast<base2&&>(b2);
     assert(move_assign == 1);
+    return 0;
 }
 
 int main()