Bug 27175 - No code generated for Explicit Template Instantations on gcc 4.0+
Summary: No code generated for Explicit Template Instantations on gcc 4.0+
Status: RESOLVED DUPLICATE of bug 24511
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: link-failure
Depends on:
Blocks:
 
Reported: 2006-04-15 12:41 UTC by Veselin Georgiev
Modified: 2006-04-15 16:33 UTC (History)
7 users (show)

See Also:
Host: i386-pc-gnu
Target: i386-pc-gnu
Build: i386-pc-gnu
Known to work: 3.3.6 3.4.5
Known to fail: 4.0.1 4.1.0
Last reconfirmed:


Attachments
A testcase that exploits the bug (648 bytes, application/zip)
2006-04-15 12:42 UTC, Veselin Georgiev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Veselin Georgiev 2006-04-15 12:41:17 UTC
When the line that requests explicit template instantation is before the actual template class method definitions, g++ 4.0 and 4.1 fail to generate the code for those methods, resulting in linking errors later. But gcc 3.3 and 3.4 both have no problems (as well as icc and msvc).

Moving the "template class foo<5>;" line after the definitions fixes this. I'm not sure what the C++ standard says about that...

-- Steps to reproduce --
Grab the attached simple testcase. Issue "make"

-- Actual results --
Linking fails.

-- Expected results --
Should link successfully.

-- Build date and platform --
gcc 4.1.0 (fedora core 5 default)

-- Additional builds and platforms --
 - Also occurs on -
  gcc 4.0.1 (fedora core 4 defulat) - DOESN't work

 - Doesn't occur on -
  gcc 3.3.6 (slackware 10.2 default)
  gcc 3.4 (fedora core 3 default)
Comment 1 Veselin Georgiev 2006-04-15 12:42:57 UTC
Created attachment 11275 [details]
A testcase that exploits the bug
Comment 2 Andrew Pinski 2006-04-15 16:33:45 UTC
GCC is correct. Please read PR 24511 and DR 470 to learn more.

*** This bug has been marked as a duplicate of 24511 ***