Patchwork C++ PATCH for c++/51530 (ICE in unify with nullptr)

login
register
mail settings
Submitter Jason Merrill
Date Dec. 19, 2011, 10:07 p.m.
Message ID <4EEFB5A8.6050103@redhat.com>
Download mbox | patch
Permalink /patch/132325/
State New
Headers show

Comments

Jason Merrill - Dec. 19, 2011, 10:07 p.m.
Just missing a case.

Tested x86_64-pc-linux-gnu, applying to trunk.
Paolo Carlini - Dec. 19, 2011, 10:17 p.m.
On 12/19/2011 11:07 PM, Jason Merrill wrote:
> Just missing a case.
Indeed. Thanks!

Paolo.

Patch

commit cd8d1cb9501d6151febfba17c240f8bbba2d25af
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Dec 19 16:28:19 2011 -0500

    	PR c++/51530
    	* pt.c (unify): Handle NULLPTR_TYPE.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 66d4c3f..769b610 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -16614,6 +16614,7 @@  unify (tree tparms, tree targs, tree parm, tree arg, int strict,
     case BOOLEAN_TYPE:
     case ENUMERAL_TYPE:
     case VOID_TYPE:
+    case NULLPTR_TYPE:
       if (TREE_CODE (arg) != TREE_CODE (parm))
 	return unify_type_mismatch (explain_p, parm, arg);
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr26.C b/gcc/testsuite/g++.dg/cpp0x/nullptr26.C
new file mode 100644
index 0000000..b7421b8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr26.C
@@ -0,0 +1,13 @@ 
+// PR c++/51530
+// { dg-options -std=c++0x }
+
+template <class T, class U>
+void f(T, U);
+
+template <class T>
+void f(T, decltype(nullptr));
+
+int main()
+{
+  f(1, nullptr);
+}