This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/51680] g++ 4.7 fails to inline trivial template stuff


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51680

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-12-28 20:09:32 UTC ---
(In reply to comment #6)
> Well, it's just an impression ... :]
> 
> I think one reason is that unlike normal functions, template functions are
> implicitly sort of "local" (by necessity), in that they can have a definition
> in many compilation units without causing a link conflict.  To get this effect
> for normal functions, one must use the "static" or "inline" keywords -- so the
> impression (rightly or wrongly) is that template functions definitions are like
> one of those.


Inline functions and templates both have vague linkage, which is how they avoid
multiple definitions. That has nothing to do with inlining.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]