Commit ec62cbe1 by Jason Merrill Committed by Jason Merrill

re PR c++/52988 (std::async not executed on function returning nullptr_t)

	PR c++/52988
	* typeck.c (decay_conversion): Don't discard side-effects from
	expressions of nullptr_t.

From-SVN: r188955
parent 8490252a
2012-06-25 Jason Merrill <jason@redhat.com>
PR c++/52988
* typeck.c (decay_conversion): Don't discard side-effects from
expressions of nullptr_t.
2012-06-25 Florian Weimer <fweimer@redhat.com> 2012-06-25 Florian Weimer <fweimer@redhat.com>
* init.c (build_new_1): Warn about (T[N]) for variable N, and * init.c (build_new_1): Warn about (T[N]) for variable N, and
......
...@@ -1843,7 +1843,7 @@ decay_conversion (tree exp, tsubst_flags_t complain) ...@@ -1843,7 +1843,7 @@ decay_conversion (tree exp, tsubst_flags_t complain)
if (error_operand_p (exp)) if (error_operand_p (exp))
return error_mark_node; return error_mark_node;
if (NULLPTR_TYPE_P (type)) if (NULLPTR_TYPE_P (type) && !TREE_SIDE_EFFECTS (exp))
return nullptr_node; return nullptr_node;
/* build_c_cast puts on a NOP_EXPR to make the result not an lvalue. /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
......
2012-06-25 Jason Merrill <jason@redhat.com>
PR c++/52988
* g++.dg/cpp0x/nullptr28.C: New.
2012-06-25 Christophe Lyon <christophe.lyon@st.com> 2012-06-25 Christophe Lyon <christophe.lyon@st.com>
* gcc.target/arm/neon-vld1_dupQ.c: New. * gcc.target/arm/neon-vld1_dupQ.c: New.
......
// { dg-do run { target c++11 } }
typedef decltype(nullptr) nullptr_t;
int i;
nullptr_t n;
const nullptr_t& f() { ++i; return n; }
nullptr_t g() { return f(); }
int main()
{
g();
if (i != 1)
__builtin_abort ();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment