diff mbox

C++ PATCH for C++17 selection statements with initializer

Message ID 20161116010157.GG3646@redhat.com
State New
Headers show

Commit Message

Marek Polacek Nov. 16, 2016, 1:01 a.m. UTC
On Sat, Nov 05, 2016 at 10:03:37PM -0400, David Edelsohn wrote:
> The patch adds testcase init-statement6.C, which includes the declaration
> 
> extern void publish (int), raise (int);
> 
> POSIX defines
> 
> int raise (int);
> 
> in <signal.h> which gets included by the C++ headers for the testcase on AIX.
> 
> This is causes the error message:
> 
> /nasfarm/edelsohn/src/src/gcc/testsuite/g++.dg/cpp1z/init-statement6.C:10:28:
> error: ambiguating new declaration of 'void raise(int)'
> ...
> /tmp/GCC/gcc/include-fixed/sys/signal.h:103:12: note: old declaration
> 'int raise(int)'
> 
> Is there a reason for the conflicting / ambiguating declaration?

Oops, no reason at all.  I'm fixing this with:

Tested on x86_64-linux, applying to trunk.

2016-11-15  Marek Polacek  <polacek@redhat.com>

	* g++.dg/cpp1z/init-statement6.C: Rename a function.


	Marek
diff mbox

Patch

diff --git gcc/testsuite/g++.dg/cpp1z/init-statement6.C gcc/testsuite/g++.dg/cpp1z/init-statement6.C
index 53b0d31..e8e24b5 100644
--- gcc/testsuite/g++.dg/cpp1z/init-statement6.C
+++ gcc/testsuite/g++.dg/cpp1z/init-statement6.C
@@ -7,14 +7,14 @@ 
 
 std::map<int, std::string> m;
 extern int xread (int *);
-extern void publish (int), raise (int);
+extern void publish (int), xraise (int);
 
 void
 foo ()
 {
   if (auto it = m.find (10); it != m.end ()) { std::string s = it->second; }
   if (char buf[10]; std::fgets(buf, 10, stdin)) { m[0] += buf; }
-  if (int s; int count = xread (&s)) { publish(count); raise(s); }
+  if (int s; int count = xread (&s)) { publish(count); xraise(s); }
 
   const char *s;
   if (auto keywords = {"if", "for", "while"};