This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

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


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

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2017-11-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* g++.dg/cpp0x/rv-trivial-bug.C (test2): Return a value.

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()

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