https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118530
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Depends on| |112810
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
For 'auto' issues / return-type issues in general, see also PR112810.
* * *
For the last testcase, it fails in decl.cc's
8559 fail = !comptypes (TREE_TYPE (decl), TREE_TYPE (variant),
8560 COMPARE_STRICT);
with debug(decl) and debug(variant) printing:
full-name "auto base(T) [with T = int]"
full-name "auto variant(T) [with T = int]"
The types as seen by comparetypes are:
type <template_type_parm 0x7ffff73d2690 auto ...
arg-types <tree_list ...
value <integer_type 0x7ffff72285e8 int
type <integer_type 0x7ffff72285e8 int
Thus, while the variant function is template-resolved, the base function isn't,
causing the type mismatch.
* * *
For 'variant' this conversion happens in call.cc's build_over_call via
if (!already_used
&& !mark_used (fn, complain))
where decl2.cc's 'mark_used' code calls
if (undeduced_auto_decl (decl)
maybe_instantiate_decl (decl);
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112810
[Bug 112810] bogus ambiguous overload resolution when taking address of
static/xobj member function template introduced by using declaration where
candidates have a mismatched deduced return type