From afb86620e1ae16abdde90ccca6e106472ef6d70d Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Thu, 17 Jul 2008 09:11:11 +0000 Subject: [PATCH] re PR c++/36855 (__has_trivial_destructor() returns false for reference types.) /cp 2008-07-17 Paolo Carlini PR c++/36855 * semantics.c (trait_expr_value): Update __has_trivial_destructor semantics to the current WP (N2691). /testsuite 2008-07-17 Paolo Carlini PR c++/36855 * g++.dg/ext/has_trivial_destructor.C: Rename to... * g++.dg/ext/has_trivial_destructor-1.C: ... this. * g++.dg/ext/has_trivial_destructor-2.C: New. From-SVN: r137914 --- gcc/cp/ChangeLog | 13 +++++++++---- gcc/cp/semantics.c | 2 +- gcc/testsuite/ChangeLog | 7 +++++++ ...vial_destructor.C => has_trivial_destructor-1.C} | 0 gcc/testsuite/g++.dg/ext/has_trivial_destructor-2.C | 3 +++ 5 files changed, 20 insertions(+), 5 deletions(-) rename gcc/testsuite/g++.dg/ext/{has_trivial_destructor.C => has_trivial_destructor-1.C} (100%) create mode 100644 gcc/testsuite/g++.dg/ext/has_trivial_destructor-2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8f87551ee36..0e537b855c7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,8 +1,13 @@ +2008-07-17 Paolo Carlini + + PR c++/36855 + * semantics.c (trait_expr_value): Update __has_trivial_destructor + semantics to the current WP (N2691). + 2008-07-16 Dodji Seketeli PR c++/13699 - * gcc/cp/name-lookup.c (lookup_extern_c_fun_binding_in_all_ns): - New function. + * name-lookup.c (lookup_extern_c_fun_binding_in_all_ns): New function. (pushdecl_maybe_friend): Check if a redeclaration of extern C function complies with exception specification constraints. @@ -22,8 +27,8 @@ PR c++/13101 * decl.c (grokdeclarator): Warn about initializing variables - of storage class 'extern' only after the type of the declarator - has been properly computed. + of storage class 'extern' only after the type of the declarator + has been properly computed. 2008-07-11 Dodji Seketeli diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 17b1e5dee49..d2f56ea810a 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -4730,7 +4730,7 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2) case CPTK_HAS_TRIVIAL_DESTRUCTOR: type1 = strip_array_types (type1); - return (pod_type_p (type1) + return (pod_type_p (type1) || type_code1 == REFERENCE_TYPE || (CLASS_TYPE_P (type1) && TYPE_HAS_TRIVIAL_DESTRUCTOR (type1))); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ec7dc0540d8..528a1114b30 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2008-07-17 Paolo Carlini + + PR c++/36855 + * g++.dg/ext/has_trivial_destructor.C: Rename to... + * g++.dg/ext/has_trivial_destructor-1.C: ... this. + * g++.dg/ext/has_trivial_destructor-2.C: New. + 2008-07-17 Paolo Bonzini PR rtl-optimization/36753 diff --git a/gcc/testsuite/g++.dg/ext/has_trivial_destructor.C b/gcc/testsuite/g++.dg/ext/has_trivial_destructor-1.C similarity index 100% rename from gcc/testsuite/g++.dg/ext/has_trivial_destructor.C rename to gcc/testsuite/g++.dg/ext/has_trivial_destructor-1.C diff --git a/gcc/testsuite/g++.dg/ext/has_trivial_destructor-2.C b/gcc/testsuite/g++.dg/ext/has_trivial_destructor-2.C new file mode 100644 index 00000000000..f9dacf179e1 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/has_trivial_destructor-2.C @@ -0,0 +1,3 @@ +// PR c++/36855 + +typedef char assert_0 [__has_trivial_destructor (int&) ? 1 : -1]; -- 2.30.2