This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/23708] Non-inline function incorrectly treated as inline when using precompiled headers
- From: "jconner at apple dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Sep 2005 02:09:15 -0000
- Subject: [Bug c++/23708] Non-inline function incorrectly treated as inline when using precompiled headers
- References: <20050903015707.23708.jconner@apple.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From jconner at apple dot com 2005-09-03 02:09 -------
When generating a precompiled header, finish_member_declaration() invokes note_decl_for_pch() for
the function "testfn<T>", and assigns it to the COMDAT section with weak linkage.
Then, when the test.C file is compiled, a function "testfn<int> (implicit declaration)" is generated, and
inherits the COMDAT properties of "testfn<T>". Finally, when the explicit specialization is actually
seen, the function duplicate_decls() attempts to merge the declarations, and assigns the specialization
function (incorrectly) to the COMDAT section.
When not using precompiled headers, the "testfn<T>" function is not assigned to the COMDAT section
until after its attributes are merged with the specialization by duplicate_decls(), and since checks are
already in place to make sure that the specialization doesn't inherit the DECL_DECLARED_INLINE_P
attribute (which is a prerequesite for ending up in COMDAT), both decls are assigned to the correct
sections.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23708