Patch for enum's as template parameters
Jason Merrill
jason@cygnus.com
Wed Jan 28 11:00:00 GMT 1998
I prefer this fix:
Wed Jan 28 10:55:47 1998 Jason Merrill <jason@yorick.cygnus.com>
* pt.c (convert_nontype_argument): Use decl_constant_value.
Index: pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.53
diff -c -p -r1.53 pt.c
*** pt.c 1998/01/27 20:47:54 1.53
--- pt.c 1998/01/28 18:57:30
*************** convert_nontype_argument (type, expr)
*** 1412,1424 ****
--a pointer to member expressed as described in _expr.unary.op_. */
if (INTEGRAL_TYPE_P (expr_type)
|| TYPE_PTRMEM_P (expr_type)
|| TYPE_PTRMEMFUNC_P (expr_type))
{
! if (!TREE_CONSTANT (expr)
! /* FIXME: Should this case be handled by fold()? Why not? */
! && !(TREE_CODE (expr) == VAR_DECL && TREE_READONLY (expr)))
{
cp_error ("non-constant `%E' cannot be used as template argument",
expr);
--- 1412,1425 ----
--a pointer to member expressed as described in _expr.unary.op_. */
+ if (TREE_READONLY_DECL_P (expr))
+ expr = decl_constant_value (expr);
+
if (INTEGRAL_TYPE_P (expr_type)
|| TYPE_PTRMEM_P (expr_type)
|| TYPE_PTRMEMFUNC_P (expr_type))
{
! if (! TREE_CONSTANT (expr))
{
cp_error ("non-constant `%E' cannot be used as template argument",
expr);
More information about the Gcc-bugs
mailing list