Patchwork C++ PATCH for c++/53882 (ICE with bind, nullptr and -O)

login
register
mail settings
Submitter Jason Merrill
Date July 9, 2012, 2:09 p.m.
Message ID <4FFAE601.2090503@redhat.com>
Download mbox | patch
Permalink /patch/169851/
State New
Headers show

Comments

Jason Merrill - July 9, 2012, 2:09 p.m.
We also need to handle NULLPTR_TYPE in type_contains_placeholder.  While 
I was at it, I added a NULLPTR_TYPE case to type_hash_eq just in case.

Tested x86_64-pc-linux-gnu, applying to trunk and 4.7.

Patch

commit 05eb87b7123c9161268a0ef89b160c489a3d4935
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Jul 9 15:39:06 2012 +0200

    	PR c++/53882
    	* tree.c (type_contains_placeholder_1): Handle NULLPTR_TYPE.
    	(type_hash_eq): Likewise.

diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr29.C b/gcc/testsuite/g++.dg/cpp0x/nullptr29.C
new file mode 100644
index 0000000..a8e35a9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr29.C
@@ -0,0 +1,4 @@ 
+// PR c++/53882
+// { dg-options "-std=gnu++11 -O" }
+
+void f(decltype(nullptr) &__restrict np) { }
diff --git a/gcc/tree.c b/gcc/tree.c
index 9be0c9a..f92f070 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -2980,6 +2980,7 @@  type_contains_placeholder_1 (const_tree type)
     case METHOD_TYPE:
     case FUNCTION_TYPE:
     case VECTOR_TYPE:
+    case NULLPTR_TYPE:
       return false;
 
     case INTEGER_TYPE:
@@ -6188,6 +6189,7 @@  type_hash_eq (const void *va, const void *vb)
     case COMPLEX_TYPE:
     case POINTER_TYPE:
     case REFERENCE_TYPE:
+    case NULLPTR_TYPE:
       return 1;
 
     case VECTOR_TYPE: