aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-03-15 14:27:29 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-03-15 14:27:29 -0400
commit92d0652c1eda06a6ec396470550aede34cb72079 (patch)
tree5ff8b7272946b5c3f601006b9e0e83b08fee4c8a /gcc
parent437697b8ee8aecb8423600201c57641e52ca132d (diff)
downloadgcc-92d0652c1eda06a6ec396470550aede34cb72079.zip
gcc-92d0652c1eda06a6ec396470550aede34cb72079.tar.gz
gcc-92d0652c1eda06a6ec396470550aede34cb72079.tar.bz2
Core 1191
Core 1191 * method.c (synthezized_method_walk): Cleanups don't affect the triviality of a constructor, but do affect deletion and exception specification. From-SVN: r171011
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/method.c30
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/implicit11.C17
4 files changed, 37 insertions, 21 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index bbc5662..910a7e2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2011-03-15 Jason Merrill <jason@redhat.com>
+
+ Core 1191
+ * method.c (synthesized_method_walk): Cleanups don't affect the
+ triviality of a constructor, but do affect deletion and exception
+ specification.
+
2011-03-15 Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
* decl2.c (cp_check_const_attributes): New.
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index d70da95..0366988 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1080,14 +1080,9 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
tsubst_flags_t complain;
const char *msg;
bool ctor_p;
- tree cleanup_spec;
- bool cleanup_trivial = true;
- bool cleanup_deleted = false;
- cleanup_spec
- = (cxx_dialect >= cxx0x ? noexcept_true_spec : empty_except_spec);
if (spec_p)
- *spec_p = cleanup_spec;
+ *spec_p = (cxx_dialect >= cxx0x ? noexcept_true_spec : empty_except_spec);
if (deleted_p)
{
@@ -1228,8 +1223,10 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
destructors for cleanup of partially constructed objects. */
rval = locate_fn_flags (base_binfo, complete_dtor_identifier,
NULL_TREE, flags, complain);
- process_subob_fn (rval, false, &cleanup_spec, &cleanup_trivial,
- &cleanup_deleted, NULL, NULL,
+ /* Note that we don't pass down trivial_p; the subobject
+ destructors don't affect triviality of the constructor. */
+ process_subob_fn (rval, false, spec_p, NULL,
+ deleted_p, NULL, NULL,
basetype);
}
@@ -1275,8 +1272,8 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
{
rval = locate_fn_flags (base_binfo, complete_dtor_identifier,
NULL_TREE, flags, complain);
- process_subob_fn (rval, false, &cleanup_spec, &cleanup_trivial,
- &cleanup_deleted, NULL, NULL,
+ process_subob_fn (rval, false, spec_p, NULL,
+ deleted_p, NULL, NULL,
basetype);
}
}
@@ -1295,23 +1292,14 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
if (ctor_p)
walk_field_subobs (TYPE_FIELDS (ctype), complete_dtor_identifier,
sfk_destructor, TYPE_UNQUALIFIED, false,
- false, false, &cleanup_spec, &cleanup_trivial,
- &cleanup_deleted, NULL,
+ false, false, spec_p, NULL,
+ deleted_p, NULL,
NULL, flags, complain);
pop_scope (scope);
--cp_unevaluated_operand;
--c_inhibit_evaluation_warnings;
-
- /* If the constructor isn't trivial, consider the subobject cleanups. */
- if (ctor_p && trivial_p && !*trivial_p)
- {
- if (deleted_p && cleanup_deleted)
- *deleted_p = true;
- if (spec_p)
- *spec_p = merge_exception_specifiers (*spec_p, cleanup_spec);
- }
}
/* DECL is a deleted function. If it's implicitly deleted, explain why and
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 40c5316..3d75d5e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2011-03-15 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/implicit11.C: New.
+
2011-03-15 Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
* g++.dg/cpp0x/constexpr-attribute.C: New.
diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit11.C b/gcc/testsuite/g++.dg/cpp0x/implicit11.C
new file mode 100644
index 0000000..7ec8e95
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/implicit11.C
@@ -0,0 +1,17 @@
+// Test that we consider base dtors in determining whether
+// a derived ctor is deleted even if the ctor is trivial.
+// { dg-options -std=c++0x }
+
+struct A
+{
+ ~A() = delete; // { dg-error "declared here" }
+};
+
+struct B: A { }; // { dg-error "deleted" }
+
+extern B eb;
+int main()
+{
+ B* b1 = new B; // { dg-error "use of deleted function" "" { xfail *-*-* } }
+ B* b2 = new B(eb); // { dg-error "use of deleted function" }
+}