PR c++/42466
* pt.c (reduce_template_parm_level): Check the type before
returning cached TEMPLATE_PARM_INDEX.
From-SVN: r155411
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.
{
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;
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.
--- /dev/null
+// 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;
+}