Bug 14241 - ICE when returning template class where template argument is a template function
Summary: ICE when returning template class where template argument is a template function
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3.2
: P2 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-22 07:56 UTC by Allan Odgaard
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Allan Odgaard 2004-02-22 07:56:37 UTC
The following code:
============================
template <typename T> void f () { }
template <void(*F)()> struct B { };
template <typename T> B< f<int> > g (T) { return B< f<int> >(); }

int main (int argc, char const* argv[])
{
        g(0);
        return 0;
}
============================
If "B< f<int> >" is replaced with a typedef, the program compiles.

The problem exists with both gcc 2.x and 3.x and I have verified it under different distributions of linux 
(and therefor gcc) plus Mac OS X (with apple's modified gcc).

The output from the compiler is:
In function `int main(int, const char**)':
internal compiler error: Bus error

(or segmentation fault on other systems)
Comment 1 Giovanni Bajo 2004-02-23 00:52:56 UTC
Confirmed, but already fixed in GCC 3.4.0. Not being a regression and most 
likely a parser issue, this will not be fixed in 3.3. Thanks for your report.