[Bug c++/86246] [8/9 Regression] Template dispatching error inside a template function

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 21 13:18:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86246

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Nathan Sidwell from comment #2)
> This no longer ices.  and I am not sure the code is well formed.  The code
> is explicitly naming a conversion operator 'obj.operator T()', which is not
> the same as relying on the conversion mechanism of 'static_cast <T> (obj)'. 
> do we perform the lookup at template-definition time (using 'T'), or do we
> defer to instantiation time and use 'double'.

I think [temp.mem] is reasonably clear about this:

6 A specialization of a conversion function template is not found by name
lookup. Instead, any conversion function templates visible in the context of
the use are considered. For each such operator, if argument deduction succeeds
(17.9.2.3), the resulting specialization is used as if found by name lookup.

This sounds to me like we should defer to instantiation time.


More information about the Gcc-bugs mailing list