A problem of template implicit instantiation

Yu Sheng Oh humbleoh@gmail.com
Fri Dec 5 15:51:00 GMT 2014


Yup, it may refer to the same issue which you have pointed out. But,
why the compiler deduce the return type in a inconsistent way, where
it can correctly deduce the return type in a single simple statement,
whereas it fails in another way? Thanks.

On Fri, Dec 5, 2014 at 11:19 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 5 December 2014 at 02:31, Yu Sheng Oh wrote:
>> HI,
>>
>> I have a piece of code at http://goo.gl/r2ySE6
>>
>> Refer to the code, with option of "-O2 -std=c++1y", when we comment
>> out the statement "id<int>;" clang-3.4.1 compiles the code
>> successfully, but g++-4.9.0 compiles failed, where g++ complains that
>> "unresolved overloaded function type", which in turn implies that at
>> the point of calling compose function, id<int> is not instantiated.
>
> It does seem to be a bug, but I don't think the problem is that the
> function isn't instantiated.
>
> I think the compiler is failing to deduce the return type of id<int>,
> because it works if you change it to not use "auto" as the return
> type.
>
> I've reported it to Bugzilla as
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59912 with a simpler
> example, thanks for reporting it to us.



More information about the Gcc-help mailing list