This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51680] g++ 4.7 fails to inline trivial template stuff
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 28 Dec 2011 20:09:32 +0000
- Subject: [Bug c++/51680] g++ 4.7 fails to inline trivial template stuff
- Auto-submitted: auto-generated
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; b=oKU1wPKLmezAR+CIK2q1ZYb4HYMra6G59y7IpFVDqsbRRGwyF13iwG53Tn0LM1KfyZTzUf9RvlLIkBy8G6Genpr9ORLELUdy5p2pscu+zeqJ4JIuCVFwukfMBrXRYBvyRdkgJNWgTcCMvce4Nd3q4wD5K+G7jRV39MumFQ0epV4= ;
- References: <bug-51680-4@http.gcc.gnu.org/bugzilla/>
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.