PR c++/45, c++/3784
* tree.c (cp_tree_equal, TEMPLATE_PARM_INDEX): The types must be
the same too.
testsuite:
* g++.dg/template/ntp2.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@60839
138bc75d-0d04-0410-961f-
82ee72b054a4
+2003-01-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/45, c++/3784
+ * tree.c (cp_tree_equal, TEMPLATE_PARM_INDEX): The types must be
+ the same too.
+
2003-01-03 Graham Stott <graham.stott@btinternet.com>
* parser.c (struct cp_parser): Add access_checks_lists field
return 0;
case TEMPLATE_PARM_INDEX:
- return TEMPLATE_PARM_IDX (t1) == TEMPLATE_PARM_IDX (t2)
- && TEMPLATE_PARM_LEVEL (t1) == TEMPLATE_PARM_LEVEL (t2);
+ return (TEMPLATE_PARM_IDX (t1) == TEMPLATE_PARM_IDX (t2)
+ && TEMPLATE_PARM_LEVEL (t1) == TEMPLATE_PARM_LEVEL (t2)
+ && same_type_p (TREE_TYPE (TEMPLATE_PARM_DECL (t1)),
+ TREE_TYPE (TEMPLATE_PARM_DECL (t2))));
case SIZEOF_EXPR:
case ALIGNOF_EXPR:
+2003-01-03 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.dg/template/ntp2.C: New test.
+
2003-01-03 Nathanael Nerode <neroden@gcc.gnu.org>
* g++.dg/parse/extern-C-1.C: New test.
--- /dev/null
+// { dg-do compile }
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 26 Dec 2002 <nathan@codesourcery.com>
+
+// PR 3784: We were confusing non-type template parms.
+
+template <unsigned N> class X { };
+
+template <short N> void foo1(X<N>);
+template <unsigned N> void foo2(X<N>);
+
+int main() {
+ X<2> x;
+ foo2(x);
+}