Commit 41496424 by Jason Merrill Committed by Jason Merrill

re PR c++/58954 (accessing a private member function in decltype of a friend…

re PR c++/58954 (accessing a private member function in decltype of a friend class causes access control error)

	PR c++/58954
	* pt.c (resolve_overloaded_unification): Use instantiate_template.

From-SVN: r205952
parent 0bce3228
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> 2013-12-12 Jakub Jelinek <jakub@redhat.com>
PR c++/58627 PR c++/58627
......
...@@ -16407,7 +16407,7 @@ resolve_overloaded_unification (tree tparms, ...@@ -16407,7 +16407,7 @@ resolve_overloaded_unification (tree tparms,
if (subargs != error_mark_node if (subargs != error_mark_node
&& !any_dependent_template_arguments_p (subargs)) && !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, if (try_one_overload (tparms, targs, tempargs, parm,
elem, strict, sub_strict, addr_p, explain_p) elem, strict, sub_strict, addr_p, explain_p)
&& (!goodfn || !same_type_p (goodfn, elem))) && (!goodfn || !same_type_p (goodfn, elem)))
......
// 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment