summaryrefslogtreecommitdiff
path: root/gcc/cp/method.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2011-02-16 00:39:27 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2011-02-16 00:39:27 +0000
commit92b327d32c9ba6f27167c4e8e2fda0bd8a2a51ed (patch)
treea6d0a3bb4ee91bd00b282995d12c2c735da5c1f8 /gcc/cp/method.c
parent6015f3dc5093d2dc6198eb89a2109ad8da923b79 (diff)
downloadgcc-92b327d32c9ba6f27167c4e8e2fda0bd8a2a51ed.tar.gz
PR c++/46807
* method.c (synthesized_method_walk): Always exit early for trivial fn in C++98 mode. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170207 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/method.c')
-rw-r--r--gcc/cp/method.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 3f0baed29a4..bfe8a067a8b 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1153,13 +1153,15 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
if (trivial_p)
*trivial_p = expected_trivial;
-#ifndef ENABLE_CHECKING
/* The TYPE_HAS_COMPLEX_* flags tell us about constraints from base
class versions and other properties of the type. But a subobject
class can be trivially copyable and yet have overload resolution
choose a template constructor for initialization, depending on
rvalueness and cv-quals. So we can't exit early for copy/move
- methods in C++0x. */
+ methods in C++0x. The same considerations apply in C++98/03, but
+ there the definition of triviality does not consider overload
+ resolution, so a constructor can be trivial even if it would otherwise
+ call a non-trivial constructor. */
if (expected_trivial
&& (!copy_arg_p || cxx_dialect < cxx0x))
{
@@ -1167,7 +1169,6 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
*constexpr_p = synthesized_default_constructor_is_constexpr (ctype);
return;
}
-#endif
++cp_unevaluated_operand;
++c_inhibit_evaluation_warnings;
@@ -1300,14 +1301,6 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
if (spec_p)
*spec_p = merge_exception_specifiers (*spec_p, cleanup_spec);
}
-
-#ifdef ENABLE_CHECKING
- /* If we expected this to be trivial but it isn't, then either we're in
- C++0x mode and this is a copy/move ctor/op= or there's an error. */
- gcc_assert (!(trivial_p && expected_trivial && !*trivial_p)
- || (copy_arg_p && cxx_dialect >= cxx0x)
- || errorcount);
-#endif
}
/* DECL is a deleted function. If it's implicitly deleted, explain why and