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++/23708] Non-inline function incorrectly treated as inline when using precompiled headers


------- 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


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