Commit 73974561 by Paolo Carlini Committed by Paolo Carlini

re PR c++/83806 (Spurious -Wunused-but-set-parameter with nullptr)

/cp
2018-02-08  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/83806
	* typeck.c (decay_conversion): Use mark_rvalue_use for the special
	case of nullptr too.

/testsuite
2018-02-08  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/83806
	* g++.dg/warn/Wunused-parm-11.C: New.

From-SVN: r257502
parent b00dcb13
2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/83806
* typeck.c (decay_conversion): Use mark_rvalue_use for the special
case of nullptr too.
2018-02-08 Nathan Sidwell <nathan@acm.org>
* class.c (finish_struct): Fix std:initializer_list diagnostic
......
......@@ -2009,7 +2009,10 @@ decay_conversion (tree exp,
return error_mark_node;
if (NULLPTR_TYPE_P (type) && !TREE_SIDE_EFFECTS (exp))
return nullptr_node;
{
mark_rvalue_use (exp, loc, reject_builtin);
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. */
......
2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/83806
* g++.dg/warn/Wunused-parm-11.C: New.
2018-02-08 Marek Polacek <polacek@redhat.com>
PR tree-optimization/84238
......
// PR c++/83806
// { dg-do compile { target c++11 } }
// { dg-options "-Wunused-but-set-parameter" }
template <class X, class Y>
bool equals(X x, Y y) {
return (x == y);
}
int main() {
const char* p = nullptr;
equals(p, nullptr);
}
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