This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] [PR14246] ICE while mangling boolean nodes in templates (regression)
Jason Merrill wrote:
> We could retain the sanity check by verifying that if integer_zerop is
> false, integer_onep is true.
Right. Tested again on i686-pc-linux-gnu with no new regressions, OK for
mainline and 3.4?
Giovanni Bajo
2004-02-24 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/14246
* mangle.c (write_template_arg_literal): Don't rely on identity for
boolean constants.
2004-02-24 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/14246
* g++.dg/other/crash-3.C: New test.
Index: mangle.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/mangle.c,v
retrieving revision 1.98
diff -c -3 -p -r1.98 mangle.c
*** mangle.c 17 Feb 2004 18:32:42 -0000 1.98
--- mangle.c 25 Feb 2004 02:10:34 -0000
*************** write_template_arg_literal (const tree v
*** 2121,2129 ****
{
if (same_type_p (type, boolean_type_node))
{
! if (value == boolean_false_node || integer_zerop (value))
write_unsigned_number (0);
! else if (value == boolean_true_node)
write_unsigned_number (1);
else
abort ();
--- 2121,2129 ----
{
if (same_type_p (type, boolean_type_node))
{
! if (integer_zerop (value))
write_unsigned_number (0);
! else if (integer_onep (value))
write_unsigned_number (1);
else
abort ();
// { dg-do compile }
// { dg-options "-g" }
// Contributed by: <schmid at snake dot iap dot physik dot tu-darmstadt dot de>
// and Niall Douglas <s_gccbugzilla at nedprod dot com>
// PR c++/14246: ice in write_template_arg_literal while mangling boolean
// expressions.
namespace N1 {
template <typename T>
struct A {
enum { Yes = (sizeof(T) == 1) };
};
template<bool T>
struct B {
void foo(void);
};
template struct B< !A<int>::Yes >;
}
namespace N2 {
template<bool> struct A {};
A<!false> a;
}