A problem of template implicit instantiation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

"3. Unless a function template specialization has been explicitly
instantiated or explicitly specialized, *the function template
specialization is implicitly instantiated  when the specialization is
referenced in a context that requires a function definition to exist.*
"[temp.inst]

At the point of calling the compose function, the function definition
for id<int> is required, and so, id<int> should be implicitly
instantiated.

Based on my argument, it is a bug in g++-4.9.0, but I am not 100% sure
of it. Please advice.

PS: Yongwei Wu is credited for discovering the problem.

== off topic==
I think i am going to be pissed off, because of accidentally posting
my question to gcc-bugs mail list. I sincerely apologize for it.
Sorry.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux