commit 32bf8cd06a9d5e2ad4abd35ce3571457a071b27d
Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri May 10 14:17:45 2013 +0000
PR c++/57196
* pt.c (convert_template_argument): Use dependent_template_arg_p,
not uses_template_parms.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198778 138bc75d-0d04-0410-961f-82ee72b054a4
@@ -6368,7 +6368,8 @@ convert_template_argument (tree parm,
val = error_mark_node;
}
}
- else if (!uses_template_parms (orig_arg) && !uses_template_parms (t))
+ else if (!dependent_template_arg_p (orig_arg)
+ && !uses_template_parms (t))
/* We used to call digest_init here. However, digest_init
will report errors, which we don't want when complain
is zero. More importantly, digest_init will try too
new file mode 100644
@@ -0,0 +1,27 @@
+// PR c++/57196
+// { dg-require-effective-target c++11 }
+
+#include <initializer_list>
+
+template<class T>
+struct set {
+ set() = default;
+ set(std::initializer_list<T>){}
+};
+
+struct string {
+ string(const char*){}
+ ~string(){}
+};
+
+typedef decltype(sizeof(0)) size_t;
+
+template <size_t> struct EqHelper { };
+
+int IsNullLiteralHelper(...);
+
+void Fn() {
+ EqHelper<sizeof IsNullLiteralHelper(set<int>{1})> eq1; // ok
+ EqHelper<sizeof IsNullLiteralHelper(set<string>())> eq2; // ok
+ EqHelper<sizeof IsNullLiteralHelper(set<string>{"foo"})> eq3; // error
+}
@@ -10,3 +10,5 @@ struct A
template<T N = 0, void (A::*)() = &A::foo<N> > struct B {}; // { dg-error "type|declared" }
B<> b; // { dg-error "type|declaration" }
+
+// { dg-prune-output "could not convert" }
@@ -5,7 +5,7 @@ struct A
template<typename> void foo() {}
};
-template<void (A::*)()> struct B {}; // { dg-error "declaration" }
+template<void (A::*)()> struct B {};
template<int> struct C
{
@@ -13,3 +13,5 @@ template<int> struct C
};
C<0> c;
+
+// { dg-prune-output "could not convert" }
@@ -9,3 +9,5 @@ struct A
template<int N, void (A::*)() = &A::foo<N> > struct B {};
B<int> b; // { dg-error "type/value mismatch|expected a constant|invalid type" }
+
+// { dg-prune-output "could not convert" }