From 48e5d11979af0dd03c54623faffddc5f0c3c1741 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 29 Apr 2011 22:03:40 +0000 Subject: [PATCH] re PR c++/48606 (g++.dg/init/ctor9.C ICE: tree check: expected class 'type', have 'exceptional' (error_mark) with -fkeep-inline-functions) /cp 2011-04-29 Paolo Carlini PR c++/48606 * init.c (perform_member_init): Check build_value_init return value for error_mark_node. /testsuite 2011-04-29 Paolo Carlini PR c++/48606 * g++.dg/init/ctor10.C: New. From-SVN: r173194 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/init.c | 6 ++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/init/ctor10.C | 9 +++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/init/ctor10.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7cd5eb66bcf..55ba50bf93f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-04-29 Paolo Carlini + + PR c++/48606 + * init.c (perform_member_init): Check build_value_init return + value for error_mark_node. + 2011-04-29 Nicola Pero , Mike Stump diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 3f888576bf6..d8b19c7491e 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -513,8 +513,10 @@ perform_member_init (tree member, tree init) } else { - init = build2 (INIT_EXPR, type, decl, - build_value_init (type, tf_warning_or_error)); + tree value = build_value_init (type, tf_warning_or_error); + if (value == error_mark_node) + return; + init = build2 (INIT_EXPR, type, decl, value); finish_expr_stmt (init); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 42ea961e176..873e368c163 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-04-29 Paolo Carlini + + PR c++/48606 + * g++.dg/init/ctor10.C: New. + 2011-04-29 Paul Thomas PR fortran/48462 diff --git a/gcc/testsuite/g++.dg/init/ctor10.C b/gcc/testsuite/g++.dg/init/ctor10.C new file mode 100644 index 00000000000..91cc2501209 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/ctor10.C @@ -0,0 +1,9 @@ +// PR c++/48606 +// { dg-do compile } +// { dg-options "-fkeep-inline-functions" } + +struct S +{ + int &ref; + S() : ref() {}; // { dg-error "value-initialization of" } +}; -- 2.30.2