Bug 36855 - __has_trivial_destructor() returns false for reference types.
Summary: __has_trivial_destructor() returns false for reference types.
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.4.0
Assignee: Paolo Carlini
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-16 18:45 UTC by Travis Vitek
Modified: 2008-07-17 09:13 UTC (History)
1 user (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2008-07-16 18:58:39


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Travis Vitek 2008-07-16 18:45:00 UTC
    __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];
Comment 1 Travis Vitek 2008-07-16 18:45:00 UTC
Fix:
    A workaround would be to use a wrapper template that has a special case
    for reference types.
Comment 2 paolo@gcc.gnu.org 2008-07-17 09:11:55 UTC
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

Comment 3 Paolo Carlini 2008-07-17 09:13:44 UTC
Fixed for mainline.