Hi,
another simple fix for an ICE on invalid. Tested x86_64-linux.
Ok?
Thanks,
Paolo.
////////////////////////
/cp
2011-07-26 Paolo Carlini <[email protected]>
PR c++/49776
* typeck.c (cp_build_modify_expr): Check digest_init return value
for error_mark_node.
/testsuite
2011-07-26 Paolo Carlini <[email protected]>
PR c++/49776
* g++.dg/cpp0x/constexpr-49776.C: New.
Index: testsuite/g++.dg/cpp0x/constexpr-49776.C
===================================================================
--- testsuite/g++.dg/cpp0x/constexpr-49776.C (revision 0)
+++ testsuite/g++.dg/cpp0x/constexpr-49776.C (revision 0)
@@ -0,0 +1,17 @@
+// PR c++/49776
+// { dg-options -std=c++0x }
+
+struct s
+{
+ int i[1];
+
+ template<class... Types>
+ constexpr s(Types... args)
+ : i{args...} // { dg-error "cannot convert" }
+ { }
+};
+
+int main()
+{
+ s test = nullptr;
+}
Index: cp/typeck.c
===================================================================
--- cp/typeck.c (revision 176786)
+++ cp/typeck.c (working copy)
@@ -6753,6 +6753,8 @@ cp_build_modify_expr (tree lhs, enum tree_code mod
if (check_array_initializer (lhs, lhstype, newrhs))
return error_mark_node;
newrhs = digest_init (lhstype, newrhs, complain);
+ if (newrhs == error_mark_node)
+ return error_mark_node;
}
else if (!same_or_base_type_p (TYPE_MAIN_VARIANT (lhstype),