+2010-01-13 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/42634
+ * error.c (dump_template_parms): Use innermost template
+ arguments before calling count_non_default_template_args.
+ (count_non_default_template_args): We are being called with
+ template innermost arguments now. There is no need to ensure
+ that again.
+
2010-01-07 Dodji Seketeli <dodji@redhat.com>
c++/40155
static int
count_non_default_template_args (tree args, tree params, int flags)
{
- tree inner_args = INNERMOST_TEMPLATE_ARGS (args);
- int n = TREE_VEC_LENGTH (inner_args);
+ int n = TREE_VEC_LENGTH (args);
int last;
if (params == NULL_TREE
NULL_TREE, false, true);
--processing_template_decl;
}
- if (!cp_tree_equal (TREE_VEC_ELT (inner_args, last), def))
+ if (!cp_tree_equal (TREE_VEC_ELT (args, last), def))
break;
}
? DECL_INNERMOST_TEMPLATE_PARMS (TI_TEMPLATE (info))
: NULL_TREE);
+ args = INNERMOST_TEMPLATE_ARGS (args);
len = count_non_default_template_args (args, params, flags);
- args = INNERMOST_TEMPLATE_ARGS (args);
for (ix = 0; ix != len; ix++)
{
tree arg = TREE_VEC_ELT (args, ix);
+2010-01-13 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/42634
+ * g++.dg/template/error45.C: New test.
+
2010-01-13 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/42704
--- /dev/null
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin PR c++/42634
+// { dg-options "-g -std=gnu++0x" }
+// { dg-do compile }
+
+template<typename T> T declval();
+
+template<typename T, typename... Args> struct is_constructible {
+ template<typename T1, typename... Args1> static decltype(T1(declval<Args1>()...), char()) test();
+ static const bool value = sizeof(test<T, Args...>()) == 1;
+};
+template<bool> struct enable_if {
+ typedef void type;
+};
+template<class T1, class T2> struct pair {
+ template<class U2,
+ class = typename enable_if<is_constructible<T2,U2&&>::value>::type
+ >
+ pair(const T1&, U2&&) { }
+};
+struct string {
+ string() : p(0) {}
+ char* p;
+};
+
+struct Foo {
+ string s;
+ int i;
+};
+
+void f()
+{
+ pair<int, Foo>(1, Foo());
+}
+