This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: A problem of template implicit instantiation
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Yu Sheng Oh <humbleoh at gmail dot com>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Fri, 5 Dec 2014 15:19:16 +0000
- Subject: Re: A problem of template implicit instantiation
- Authentication-results: sourceware.org; auth=none
- References: <CAL3UPOcxkAthPLJyCFLo4J9WtMJxs-=X3OzZaF0yS5urjqpjmQ at mail dot gmail dot com>
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.