typeck.c (decay_conversion): Any expression with type nullptr_t decays to nullptr.
authorJason Merrill <jason@redhat.com>
Fri, 6 Aug 2010 19:34:49 +0000 (15:34 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 6 Aug 2010 19:34:49 +0000 (15:34 -0400)
* typeck.c (decay_conversion): Any expression with type nullptr_t
decays to nullptr.

From-SVN: r162952

gcc/cp/ChangeLog
gcc/cp/typeck.c

index ac7d3e01fdcfa4ed5a2fdcf3385292c2ca2b0921..c9cb17357267a4f73c6053f3bdb56dfad8174657 100644 (file)
@@ -1,3 +1,8 @@
+2010-08-06  Jason Merrill  <jason@redhat.com>
+
+       * typeck.c (decay_conversion): Any expression with type nullptr_t
+       decays to nullptr.
+
 2010-07-30  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
        PR c++/45112
index 484d299f4626d76479d1dca08307dee1bbda240a..177f4bb6a9029b12a96d67030adfe488f2da24ea 100644 (file)
@@ -1920,6 +1920,9 @@ decay_conversion (tree exp)
   if (error_operand_p (exp))
     return error_mark_node;
 
+  if (NULLPTR_TYPE_P (type))
+    return nullptr_node;
+
   /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
      Leave such NOP_EXPRs, since RHS is being used in non-lvalue context.  */
   code = TREE_CODE (type);