]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
pt.c (convert_nontype_argument): Handle NULLPTR_TYPE.
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 26 Sep 2011 13:58:47 +0000 (13:58 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 26 Sep 2011 13:58:47 +0000 (13:58 +0000)
/cp
2011-09-26  Paolo Carlini  <paolo.carlini@oracle.com>

* pt.c (convert_nontype_argument): Handle NULLPTR_TYPE.

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

* g++.dg/cpp0x/nullptr25.C: New.

From-SVN: r179199

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/nullptr25.C [new file with mode: 0644]

index eb870c7bd71a319f571bcdaf347d5aabb9d6a0a7..fe7589e9c7ef4623a100df7621074c56d40291f2 100644 (file)
@@ -1,3 +1,7 @@
+2011-09-26  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * pt.c (convert_nontype_argument): Handle NULLPTR_TYPE.
+
 2011-09-26  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/26747
index ebadebf1b4893e7d1550b11b4581891a2ea01b18..2c398e019ab45423283ad3d14c128dbe74042676 100644 (file)
@@ -5951,6 +5951,16 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
       if (expr == error_mark_node)
        return expr;
     }
+  else if (NULLPTR_TYPE_P (type))
+    {
+      if (expr != nullptr_node)
+       {
+         error ("%qE is not a valid template argument for type %qT "
+                "because it is of type %qT", expr, type, TREE_TYPE (expr));
+         return NULL_TREE;
+       }
+      return expr;
+    }
   /* A template non-type parameter must be one of the above.  */
   else
     gcc_unreachable ();
index 6caed7a6c108b51b1270e8a85dd96584ed4c7549..dde9c62a0d5101ec6e1a42898c416656fd9b320a 100644 (file)
@@ -1,3 +1,7 @@
+2011-09-26  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * g++.dg/cpp0x/nullptr25.C: New.
+
 2011-09-26  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/50472
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr25.C b/gcc/testsuite/g++.dg/cpp0x/nullptr25.C
new file mode 100644 (file)
index 0000000..b8a7f45
--- /dev/null
@@ -0,0 +1,6 @@
+// { dg-options -std=c++0x }
+
+template<decltype(nullptr)>
+struct nt{};
+
+nt<nullptr> x;