__has_trivial_destructor() returns false for all reference types, but should return true according to documentation. The documented behavior is consistent with what is required by the c++0x draft. Environment: System: Linux cranium 2.6.18-8.el5xen #1 SMP Fri Jan 26 14:29:35 EST 2007 x86_64 x86_64 x86_64 GNU/Linux Architecture: x86_64 host: x86_64-unknown-linux-gnu build: x86_64-unknown-linux-gnu target: x86_64-unknown-linux-gnu configured with: /build/sebor/src/gcc-4.3.0/configure --prefix=/nfs/devco/contrib/linux/gcc-4.3.0 --with-gmp=/nfs/devco/contrib/linux/gmp-4.2 --with-mpfr=/nfs/devco/contrib/linux/mpfr-2.3.1 How-To-Repeat: Attempt to compile the following code as g++ -std=gnu++0x t.cpp typedef char assert_0 [__has_trivial_destructor (int&) ? 1 : -1];
Fix: A workaround would be to use a wrapper template that has a special case for reference types.
Subject: Bug 36855 Author: paolo Date: Thu Jul 17 09:11:11 2008 New Revision: 137914 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137914 Log: /cp 2008-07-17 Paolo Carlini <paolo.carlini@oracle.com> PR c++/36855 * semantics.c (trait_expr_value): Update __has_trivial_destructor semantics to the current WP (N2691). /testsuite 2008-07-17 Paolo Carlini <paolo.carlini@oracle.com> 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. Added: trunk/gcc/testsuite/g++.dg/ext/has_trivial_destructor-1.C - copied unchanged from r137892, trunk/gcc/testsuite/g++.dg/ext/has_trivial_destructor.C trunk/gcc/testsuite/g++.dg/ext/has_trivial_destructor-2.C Removed: trunk/gcc/testsuite/g++.dg/ext/has_trivial_destructor.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/semantics.c trunk/gcc/testsuite/ChangeLog
Fixed for mainline.