summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-13 03:58:48 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-13 03:58:48 +0000
commit174a4f45f00e2647155c2e791f9c841eb657af4b (patch)
tree3a7c42192e0a6937b868e4b57f13c0b3e54a34ba
parent650d46544a3f2efcaa974e4568e66414854e8720 (diff)
downloadgcc-174a4f45f00e2647155c2e791f9c841eb657af4b.tar.gz
PR c++/58954
* pt.c (resolve_overloaded_unification): Use instantiate_template. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205952 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/pt.c2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/access02.C39
3 files changed, 45 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ca4a32113ef..59c1d5322e7 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-12 Jason Merrill <jason@redhat.com>
+
+ PR c++/58954
+ * pt.c (resolve_overloaded_unification): Use instantiate_template.
+
2013-12-12 Jakub Jelinek <jakub@redhat.com>
PR c++/58627
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 2c64a71ec0e..d566afdfcc5 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -16407,7 +16407,7 @@ resolve_overloaded_unification (tree tparms,
if (subargs != error_mark_node
&& !any_dependent_template_arguments_p (subargs))
{
- elem = tsubst (TREE_TYPE (fn), subargs, tf_none, NULL_TREE);
+ elem = TREE_TYPE (instantiate_template (fn, subargs, tf_none));
if (try_one_overload (tparms, targs, tempargs, parm,
elem, strict, sub_strict, addr_p, explain_p)
&& (!goodfn || !same_type_p (goodfn, elem)))
diff --git a/gcc/testsuite/g++.dg/cpp0x/access02.C b/gcc/testsuite/g++.dg/cpp0x/access02.C
new file mode 100644
index 00000000000..74960a66a61
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/access02.C
@@ -0,0 +1,39 @@
+// PR c++/58954
+// { dg-require-effective-target c++11 }
+
+template<class T>
+T&& declval();
+
+template<class T>
+struct foo_argument
+{
+ template<class Ret, class C, class Arg>
+ static Arg test(Ret (C::*)(Arg));
+
+ typedef decltype(test(&T::template foo<>)) type;
+};
+
+template<class T, class>
+struct dependent { typedef T type; };
+
+template<class T>
+struct base
+{
+ template<class Ignore = void>
+ auto foo(int i) -> decltype(declval<
+ typename dependent<T&, Ignore>::type
+ >().foo_impl(i));
+};
+
+struct derived : base<derived>
+{
+ friend struct base<derived>;
+private:
+ int foo_impl(int i);
+};
+
+int main()
+{
+ foo_argument<derived>::type var = 0;
+ return var;
+}