c++/8454: G++ 2.95 gives an ICE while compiling the copy constructor of template class CTTT(see attach)

jesteves@criticalsoftware.com jesteves@criticalsoftware.com
Mon Nov 4 14:56:00 GMT 2002


>Number:         8454
>Category:       c++
>Synopsis:       G++ 2.95 gives an ICE while compiling the copy constructor of template class CTTT(see attach)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 04 14:56:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     João Esteves
>Release:        gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
FreeBSD 4.1-RELEASE on i386
>Description:
bash-2.04$ g++ -o t template.cpp
template.cpp: In method `CTTT<TT,T>::CTTT(const CTTT<TT,T> &)':
template.cpp:31: Internal compiler error.
template.cpp:31: Please submit a full bug report.
template.cpp:31: See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
>How-To-Repeat:
//
// A template class with a single template parameter
//
template <class T>
class CT
{
public:
    CT(void)
    {}

    CT(const CT<T>& rc_other)
    {}

    virtual ~CT(void)
    {}
};

//
// A template class with two template parameters.
// The first template parameter is a template class itself with one
// template parameter.
//
template <template <typename> class TT, class T>
class CTTT : public TT<T>
{
public:
    CTTT(void)
    {}

    // It will fail here.
    CTTT(const CTTT<TT,T>& rc_other) : TT<T>(rc_other)
    {}

    virtual ~CTTT(void)
    {}
};

//
// Other template class.
// This time COther hinherits a hard-coded template base.
//
template <class T>
class COther : public CT<T>
{
public:
    COther(void) : CT<T>()
    {}

    COther(const COther<T>& rc_other) : CT<T>(rc_other)
    {}

    virtual ~COther(void)
    {}
};

//
// The test for the template.
// I declare an instance of each template class to force the call of all
// ctors and dtors.
//
int main()
{
    CT<int>         cT;
    CT<int>         cTCopy(cT);

    CTTT<CT,int>    cTTT;
    CTTT<CT,int>    cTTTCopy(cTTT);

    COther<int>     cO;
    COther<int>     cOCopy(cO);

    return 0;
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-prs mailing list