* typeck.c (build_static_cast): Use build_non_dependent_expr.
From-SVN: r256594
+2018-01-12 Jason Merrill <jason@redhat.com>
+
+ PR c++/83186 - ICE with static_cast of list-initialized temporary.
+ * typeck.c (build_static_cast): Use build_non_dependent_expr.
+
2018-01-12 Nathan Sidwell <nathan@acm.org>
* cp-tree.h (mark_rvalue_use): Add parm name.
TREE_SIDE_EFFECTS (expr) = 1;
return convert_from_reference (expr);
}
+ else if (processing_template_decl)
+ expr = build_non_dependent_expr (expr);
/* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
Strip such NOP_EXPRs if VALUE is being used in non-lvalue context. */
--- /dev/null
+// PR c++/83186
+// { dg-do compile { target c++11 } }
+
+struct a {
+ operator unsigned();
+};
+template <class> void b() { static_cast<unsigned>(a{}); }
+
+int main()
+{
+ b<int>();
+}