This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Patch
- To: egcs at cygnus dot com
- Subject: Patch
- From: Mark Mitchell <mmitchell at usa dot net>
- Date: Mon, 8 Sep 1997 09:52:28 -0700
- Cc: Jason Merrill <jason at cygnus dot com>, Todd Veldhuizen <todd at p200 dot cybervision dot com>
- Reply-to: mmitchell at usa dot net
Here's a patch for the abort on the following:
struct X {
enum {
a = 0,
n = 0
};
};
template<class T1, class T2>
struct Y {
enum {
a = T1::a + T2::a,
n = meta_max<T1::n,T2::n>::max // Crash here.
};
};
int z = Y<X,X>::a;
The error message that results isn't great, but at least it doesn't
fault.
--
Mark Mitchell mmitchell@usa.net
Stanford University http://www.stanford.edu
Mon Sep 8 01:21:43 1997 Mark Mitchell <mmitchell@usa.net>
* error.c (dump_decl): Avoid crahsing when presented with a
uninitialized constant, as can occur with a template parameter.
Index: error.c
===================================================================
RCS file: /home/mitchell/Repository/egcs/gcc/cp/error.c,v
retrieving revision 1.6
diff -c -p -r1.6 error.c
*** error.c 1997/09/08 09:22:41 1.6
--- error.c 1997/09/08 16:48:18
*************** dump_decl (t, v)
*** 782,791 ****
case CONST_DECL:
if ((TREE_TYPE (t) != NULL_TREE && NEXT_CODE (t) == ENUMERAL_TYPE)
! || TREE_CODE (DECL_INITIAL (t)) == TEMPLATE_CONST_PARM)
goto general;
! else
dump_expr (DECL_INITIAL (t), 0);
break;
case USING_DECL:
--- 782,794 ----
case CONST_DECL:
if ((TREE_TYPE (t) != NULL_TREE && NEXT_CODE (t) == ENUMERAL_TYPE)
! || (DECL_INITIAL (t) &&
! TREE_CODE (DECL_INITIAL (t)) == TEMPLATE_CONST_PARM))
goto general;
! else if (DECL_INITIAL (t))
dump_expr (DECL_INITIAL (t), 0);
+ else
+ OB_PUTS ("constant");
break;
case USING_DECL: