[Bug c++/14241] New: ICE when returning template class where template argument is a template function

Duff at DIKU dot DK gcc-bugzilla@gcc.gnu.org
Sun Feb 22 07:56:00 GMT 2004


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)

-- 
           Summary: ICE when returning template class where template
                    argument is a template function
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Duff at DIKU dot DK
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14241



More information about the Gcc-bugs mailing list