+2004-07-06 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ PR c++/3671
+ * pt.c (convert_nontype_argument): Disallow conversions between
+ different enumeration types.
+
2004-07-06 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (BINFO_MARKED): Remove.
conversions (_conv.integral_) are applied. */
if (!INTEGRAL_TYPE_P (expr_type))
return error_mark_node;
-
+
+ /* [conv.integral] does not allow conversions between two different
+ enumeration types. */
+ if (TREE_CODE (type) == ENUMERAL_TYPE
+ && TREE_CODE (expr_type) == ENUMERAL_TYPE
+ && !same_type_ignoring_top_level_qualifiers_p (type, expr_type))
+ return error_mark_node;
+
/* It's safe to call digest_init in this case; we know we're
just converting one integral constant expression to another. */
expr = digest_init (type, expr, (tree*) 0);
+2004-07-06 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ PR c++/3671
+ * g++.dg/template/spec14.C: New test.
+
2004-07-05 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/execute/20040629-1.c (FIELDS1, FIELDS2): Define to
--- /dev/null
+// { dg-do compile }
+// Origin: <weissr at informatik dot uni-tuebingen dot de>
+// PR c++/3671: Non-type enum parameters must not be converted
+
+enum T1 {a};
+enum T2 {b};
+
+struct Y {
+ template <T1 i> void foo() {}
+ template <T2 i> void foo() {}
+};
+
+struct Z {
+ template <T1 i> void foo() {}
+};
+
+template void Y::foo<b> ();
+template void Z::foo<b> (); // { dg-error "" }