summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-29 22:03:40 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-29 22:03:40 +0000
commit561893471fe0235f649b988b54d45678b8c87c7a (patch)
tree4303b30e583abeff4c47262505046c90b9a0162a
parent905aa3bdd9569b561aa9541ba2042062457f4373 (diff)
downloadgcc-561893471fe0235f649b988b54d45678b8c87c7a.tar.gz
/cp
2011-04-29 Paolo Carlini <paolo.carlini@oracle.com> PR c++/48606 * init.c (perform_member_init): Check build_value_init return value for error_mark_node. /testsuite 2011-04-29 Paolo Carlini <paolo.carlini@oracle.com> PR c++/48606 * g++.dg/init/ctor10.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173194 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/init.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/init/ctor10.C9
4 files changed, 24 insertions, 2 deletions
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 <paolo.carlini@oracle.com>
+
+ PR c++/48606
+ * init.c (perform_member_init): Check build_value_init return
+ value for error_mark_node.
+
2011-04-29 Nicola Pero <nicola.pero@meta-innovation.com>,
Mike Stump <mikestump@comcast.net>
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 <paolo.carlini@oracle.com>
+
+ PR c++/48606
+ * g++.dg/init/ctor10.C: New.
+
2011-04-29 Paul Thomas <pault@gcc.gnu.org>
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" }
+};