Commit b149eb04 by Jason Merrill Committed by Jason Merrill

PR c++/81236 - auto variable and auto function

	* pt.c (tsubst_baselink): Update the type of the BASELINK after
	mark_used.

From-SVN: r258547
parent e786e485
2018-03-14 Jason Merrill <jason@redhat.com> 2018-03-14 Jason Merrill <jason@redhat.com>
PR c++/81236 - auto variable and auto function
* pt.c (tsubst_baselink): Update the type of the BASELINK after
mark_used.
2018-03-14 Jason Merrill <jason@redhat.com>
PR c++/83916 - ICE with template template parameters. PR c++/83916 - ICE with template template parameters.
* pt.c (convert_template_argument): Don't substitute into type of * pt.c (convert_template_argument): Don't substitute into type of
non-type parameter if we don't have enough arg levels. non-type parameter if we don't have enough arg levels.
......
...@@ -14700,9 +14700,16 @@ tsubst_baselink (tree baselink, tree object_type, ...@@ -14700,9 +14700,16 @@ tsubst_baselink (tree baselink, tree object_type,
/* If lookup found a single function, mark it as used at this point. /* If lookup found a single function, mark it as used at this point.
(If lookup found multiple functions the one selected later by (If lookup found multiple functions the one selected later by
overload resolution will be marked as used at that point.) */ overload resolution will be marked as used at that point.) */
if (!template_id_p && !really_overloaded_fn (fns) if (!template_id_p && !really_overloaded_fn (fns))
&& !mark_used (OVL_FIRST (fns), complain) && !(complain & tf_error)) {
return error_mark_node; tree fn = OVL_FIRST (fns);
bool ok = mark_used (fn, complain);
if (!ok && !(complain & tf_error))
return error_mark_node;
if (ok && BASELINK_P (baselink))
/* We might have instantiated an auto function. */
TREE_TYPE (baselink) = TREE_TYPE (fn);
}
if (BASELINK_P (baselink)) if (BASELINK_P (baselink))
{ {
......
// { dg-do compile { target c++14 } }
template <class T> struct A
{
static auto fn() { }
static void f()
{
auto x = fn;
}
};
int main()
{
A<int>::f();
}
// CWG issue 2335
// { dg-do compile { target c++14 } }
template <class... Ts> struct partition_indices {
static auto compute_right () {}
static constexpr auto right = compute_right;
};
auto foo () -> partition_indices<>;
void f() {
auto x = foo();
auto y = x.right;
}
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