This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: correct uses of _Bool in type-traits.h & instantiations
- To: brendan at zen dot org
- Subject: Re: correct uses of _Bool in type-traits.h & instantiations
- From: Gabriel Dos Reis <gdr at codesourcery dot com>
- Date: 20 Oct 2001 02:37:03 +0200
- Cc: gcc-gnats at gcc dot gnu dot org, Ira Ruben <ira at apple dot com>, libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
- References: <20011019215508.15027.qmail@sourceware.cygnus.com>
brendan@zen.org writes:
| >Category: libstdc++
| >Synopsis: correct uses of _Bool in type-traits.h & instantiations
| >Confidential: no
| >Severity: serious
| >Priority: high
| >Class: sw-bug
| >Submitter-Id: net
| >Originator: Brendan Kehoe
| >Release: CVS tree
| >Environment:
|
| >Description:
| In type-traits.h, it creates an internal template named `_Bool', in order to make two typedefs `__true_type' and `__false_type'. While the ISO C++ standard doesn't make any mention of `_Bool', the ISO C99 C standard does reserve `_Bool' in $6.7.2.
Hi Brendan,
A partial patch for exactly this problem was posted to libstdc++
three of four days ago. Actually, the _Bool thingy can just go away,
as it is not needed.
[...]
| ! template <bool _Truth> struct _Bool {};
| ! typedef _Bool<true> __true_type;
| ! typedef _Bool<false> __false_type;
|
| template <class _Tp>
| --- 83,93 ----
| */
|
| ! // Note that we must use an internal name of __Boolean here, since the
| ! // identifier of _Bool, as we'd used in the past, is in fact reserved
| ! // by the C99 standard ($6.7.2). As such, we'd introduce headaches if
| ! // someone happens to include <stdbool.h> along with this file.
| ! template <bool _Truth> struct __Boolean {};
| ! typedef __Boolean<true> __true_type;
| ! typedef __Boolean<false> __false_type;
_Bool should go away so that the above reads
struct __true_type { };
struct __false_type { };
The rest is OK.
Thanks,
-- Gaby
CodeSourcery, LLC http://www.codesourcery.com