re PR c++/42466 (Multiple instantiations of template constructor fail)
PR c++/42466 * pt.c (reduce_template_parm_level): Check the type before returning cached TEMPLATE_PARM_INDEX. From-SVN: r155411
This commit is contained in:
parent
5666bb32d1
commit
2865105751
4 changed files with 28 additions and 1 deletions
|
@ -1,5 +1,9 @@
|
|||
2009-12-22 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/42466
|
||||
* pt.c (reduce_template_parm_level): Check the type before
|
||||
returning cached TEMPLATE_PARM_INDEX.
|
||||
|
||||
PR c++/42331
|
||||
* typeck.c (cp_build_modify_expr): Fix thinko.
|
||||
|
||||
|
|
|
@ -3356,7 +3356,8 @@ reduce_template_parm_level (tree index, tree type, int levels, tree args,
|
|||
{
|
||||
if (TEMPLATE_PARM_DESCENDANTS (index) == NULL_TREE
|
||||
|| (TEMPLATE_PARM_LEVEL (TEMPLATE_PARM_DESCENDANTS (index))
|
||||
!= TEMPLATE_PARM_LEVEL (index) - levels))
|
||||
!= TEMPLATE_PARM_LEVEL (index) - levels)
|
||||
|| !same_type_p (type, TREE_TYPE (TEMPLATE_PARM_DESCENDANTS (index))))
|
||||
{
|
||||
tree orig_decl = TEMPLATE_PARM_DECL (index);
|
||||
tree decl, t;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
2009-12-22 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/42466
|
||||
* g++.dg/template/nontype19.C: New.
|
||||
|
||||
PR c++/42331
|
||||
* g++.dg/cpp0x/initlist29.C: New.
|
||||
|
||||
|
|
19
gcc/testsuite/g++.dg/template/nontype19.C
Normal file
19
gcc/testsuite/g++.dg/template/nontype19.C
Normal file
|
@ -0,0 +1,19 @@
|
|||
// PR c++/42466
|
||||
|
||||
template<class IntT, IntT X>
|
||||
struct A
|
||||
{
|
||||
A();
|
||||
|
||||
template<IntT X2>
|
||||
A(const A<IntT, X2>& other);
|
||||
};
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
A<int, 42> a;
|
||||
A<int, 100> b = a;
|
||||
|
||||
A<unsigned, 42u> c;
|
||||
A<unsigned, 100u> d = c;
|
||||
}
|
Loading…
Add table
Reference in a new issue