diff mbox

[C++] PR 50454

Message ID 4E788271.7030009@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Sept. 20, 2011, 12:09 p.m. UTC
Hi,

as I tried to analyze/explain in the audit trail, apparently we are 
doing something bogus in grokdeclarator wrt unsigned __int128, which 
leads to the latter being wrongly rejected with -pedantic-errors, at 
variance with plain __int128 or __int128_t / __uint128_t for that 
matter. Thus I prepared the below. Tested x86_64-linux.

Ok for mainline?

Thanks,
Paolo.

/////////////////////
/cp
2011-09-20  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50454
	* decl.c (grokdeclarator): Don't reject unsigned __int128 with
	-pedantic-errors.

/testsuite
2011-09-20  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50454
	* g++.dg/ext/int128-1.C: New.

Comments

Jason Merrill Sept. 20, 2011, 1:12 p.m. UTC | #1
On 09/20/2011 08:09 AM, Paolo Carlini wrote:
> as I tried to analyze/explain in the audit trail, apparently we are
> doing something bogus in grokdeclarator wrt unsigned __int128, which
> leads to the latter being wrongly rejected with -pedantic-errors, at
> variance with plain __int128 or __int128_t / __uint128_t for that
> matter. Thus I prepared the below. Tested x86_64-linux.
>
> Ok for mainline?

No, I think we want to complain about __int128 when -pedantic unless 
we're in a system header, as C does.  The right fix is to move the 
__int128 code out of the if (unsigned_p || ...) block, and to suppress 
the pedwarn when in_system_header.

Jason
Paolo Carlini Sept. 20, 2011, 1:45 p.m. UTC | #2
On 09/20/2011 03:12 PM, Jason Merrill wrote:
> No, I think we want to complain about __int128 when -pedantic unless 
> we're in a system header, as C does.  The right fix is to move the 
> __int128 code out of the if (unsigned_p || ...) block, and to suppress 
> the pedwarn when in_system_header.
Ok, I'll do it...

Paolo.
diff mbox

Patch

Index: testsuite/g++.dg/ext/int128-1.C
===================================================================
--- testsuite/g++.dg/ext/int128-1.C	(revision 0)
+++ testsuite/g++.dg/ext/int128-1.C	(revision 0)
@@ -0,0 +1,11 @@ 
+// PR c++/50454
+// { dg-do compile { target int128 } }
+
+template<typename T>
+  struct limits;
+
+template<>
+  struct limits<__int128> { };
+
+template<>
+  struct limits<unsigned __int128> { };
Index: cp/decl.c
===================================================================
--- cp/decl.c	(revision 179004)
+++ cp/decl.c	(working copy)
@@ -8695,22 +8695,6 @@  grokdeclarator (const cp_declarator *declarator,
 	      if (flag_pedantic_errors)
 		ok = 0;
 	    }
-	  if (explicit_int128)
-	    {
-	      if (int128_integer_type_node == NULL_TREE)
-	        {
-		  error ("%<__int128%> is not supported by this target");
-		  ok = 0;
-	        }
-	      else if (pedantic)
-		{
-		  pedwarn (input_location, OPT_pedantic,
-			   "ISO C++ does not support %<__int128%> for %qs",
-			   name);
-		  if (flag_pedantic_errors)
-		    ok = 0;
-		}
-	    }
 	}
 
       /* Discard the type modifiers if they are invalid.  */