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]

Fix g++.dg/warn/Wduplicated-branches1.C with -funsigned-char


This test failed on architectures where char is unsigned by default, or
on x86_64 with -funsigned-char.  Fixed by using 'signed' explicitly.

Tested on x86_64-linux, applying to trunk.

2017-01-21  Marek Polacek  <polacek@redhat.com>

	PR testsuite/79169
	* g++.dg/warn/Wduplicated-branches1.C: Use signed char.

diff --git gcc/testsuite/g++.dg/warn/Wduplicated-branches1.C gcc/testsuite/g++.dg/warn/Wduplicated-branches1.C
index 7ebd55e..1553613 100644
--- gcc/testsuite/g++.dg/warn/Wduplicated-branches1.C
+++ gcc/testsuite/g++.dg/warn/Wduplicated-branches1.C
@@ -4,7 +4,7 @@
 
 template <typename T>
 void
-f (char i, int *p)
+f (signed char i, int *p)
 {
   if (i)
     *p = (signed short) i;
@@ -17,5 +17,5 @@ f (char i, int *p)
     *p = (unsigned short) i;
 }
 
-template void f<unsigned short>(char, int *); // { dg-message "required from here" }
-template void f<signed short>(char, int *);
+template void f<unsigned short>(signed char, int *); // { dg-message "required from here" }
+template void f<signed short>(signed char, int *);

	Marek


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