From 0c32fb95f0dc38547c4b3a50536a79cb2dc88f90 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 6 Aug 2010 15:34:49 -0400 Subject: [PATCH] typeck.c (decay_conversion): Any expression with type nullptr_t decays to nullptr. * typeck.c (decay_conversion): Any expression with type nullptr_t decays to nullptr. From-SVN: r162952 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/typeck.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ac7d3e01fdc..c9cb1735726 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2010-08-06 Jason Merrill + + * typeck.c (decay_conversion): Any expression with type nullptr_t + decays to nullptr. + 2010-07-30 Ulrich Weigand PR c++/45112 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 484d299f462..177f4bb6a90 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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); -- 2.30.2