+1998-09-03 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (finish_enum): Don't resolve CONST_DECLs to their
+ corresponding INTEGER_CSTs when processing_template_decl.
+ * pt.c (tsubst_enum): Tweak accordingly.
+
1998-09-03 Benjamin Kosnik <bkoz@rhino.cygnus.com>
* decl.c (pushdecl_class_level): Add warning here.
minnode = value;
}
- /* In the list we're building up, we want the enumeration
- values, not the CONST_DECLs. */
- TREE_VALUE (pair) = value;
+ if (processing_template_decl)
+ /* If this is just a template, leave the CONST_DECL
+ alone. That way tsubst_copy will find CONST_DECLs for
+ CONST_DECLs, and not INTEGER_CSTs. */
+ ;
+ else
+ /* In the list we're building up, we want the enumeration
+ values, not the CONST_DECLs. */
+ TREE_VALUE (pair) = value;
}
}
else
{
tree elt
= build_enumerator (TREE_PURPOSE (e),
- tsubst_expr (TREE_VALUE (e), args,
+ /* Note that in a template enum, the
+ TREE_VALUE is the CONST_DECL, not the
+ corresponding INTEGER_CST. */
+ tsubst_expr (DECL_INITIAL (TREE_VALUE (e)),
+ args,
NULL_TREE),
newtag);
--- /dev/null
+// Build don't link:
+
+template <int I>
+struct S1 { };
+
+template <class T>
+struct S2 {
+ enum { x = 3 };
+
+ void f(S1<x>&);
+};
+
+template <class T>
+void S2<T>::f(S1<x>&)
+{
+}