From 625f85e91b9b91fc3d82416abf7e00f556e6e6da Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 26 Jul 2011 20:00:31 +0000 Subject: [PATCH] re PR c++/49776 ([C++0x]ICE in build_data_member_initialization, at cp/semantics.c:5499) /cp 2011-07-26 Paolo Carlini PR c++/49776 * typeck.c (cp_build_modify_expr): Check digest_init return value for error_mark_node. /testsuite 2011-07-26 Paolo Carlini PR c++/49776 * g++.dg/cpp0x/constexpr-49776.C: New. From-SVN: r176809 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/typeck.c | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/constexpr-49776.C | 17 +++++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-49776.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fe6b7da9c8b..d169ed14a33 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-07-26 Paolo Carlini + + PR c++/49776 + * typeck.c (cp_build_modify_expr): Check digest_init return value + for error_mark_node. + 2011-07-25 Paolo Carlini PR bootstrap/49845 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 52084e6ae40..ab08eae2859 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -6753,6 +6753,8 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs, 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), diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b201960d301..f0cb44b5167 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-07-26 Paolo Carlini + + PR c++/49776 + * g++.dg/cpp0x/constexpr-49776.C: New. + 2011-07-26 Sebastian Pop PR middle-end/47046 diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-49776.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-49776.C new file mode 100644 index 00000000000..3fe3dcb86c1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-49776.C @@ -0,0 +1,17 @@ +// PR c++/49776 +// { dg-options -std=c++0x } + +struct s +{ + int i[1]; + + template + constexpr s(Types... args) + : i{args...} // { dg-error "cannot convert" } + { } +}; + +int main() +{ + s test = nullptr; +} -- 2.30.2