PR c++/45, c++/3784

cp:
	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.

From-SVN: r60839
This commit is contained in:
Nathan Sidwell 2003-01-03 17:21:14 +00:00 committed by Nathan Sidwell
parent 29456fb870
commit 317583376d
4 changed files with 30 additions and 2 deletions

View File

@ -1,3 +1,9 @@
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

View File

@ -1735,8 +1735,10 @@ cp_tree_equal (t1, t2)
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:

View File

@ -1,3 +1,7 @@
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.

View File

@ -0,0 +1,16 @@
// { 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);
}