Template ICE 191
Karl Nelson
kenelson@ece.ucdavis.edu
Tue May 11 14:21:00 GMT 1999
I appear to have found another ICE on in the template handling. The
code appears to be valid. The egcs build is not the latest so it should
be checked to see if has been fixed already. I have distilled the rather
large program down to the minumum lines necessary to reproduce the
error. If any further information is need, feel free to contact me.
--Karl
Relevent info:
Egcs version:
Precompiled egcs from redhat.
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
Error message:
ice.cc: In method `Handle<A,Extend>::Handle<ObjectReferenced, Reference>(const struct Handle<ObjectReferenced,Reference> &)':
ice.cc:53: instantiated from here
ice.cc:10: Internal compiler error 191.
ice.cc:10: Please submit a full bug report to `egcs-bugs@cygnus.com'.
Commandline arguments:
None
Envelope:
Code compiles fine when one class is used, but a class
derived from it results in ICE. The line producing the
ICE was just meant as a dummy line to prevent the procedure
from compiling is the types were incompatable. The Handle
class is a wrapper which performs these type safty checks
between unrelated classes.
Program listing:
=======================================================================
template <class Obj,class Scope_>
struct Handle
{
Scope_ scope_;
Handle(Obj &obj);
template <class Obj2,class Scope2>
Handle(const Handle<Obj2,Scope2>& handle)
:scope_()
{
Obj2 *o=(Obj*)0; // <-- ICE
}
};
struct Reference
{
Reference();
~Reference();
};
struct Scope
{
Scope();
virtual ~Scope();
};
struct Extend:public Scope
{
Extend();
virtual ~Extend();
};
struct ObjectReferenced
{
ObjectReferenced();
virtual ~ObjectReferenced();
};
struct ObjectScoped :public ObjectReferenced
{
ObjectScoped();
virtual ~ObjectScoped();
};
struct Object: public virtual ObjectScoped {};
struct A:public Object
{};
A a;
main()
{
Handle<ObjectReferenced,Reference> ra=a;
Handle<A,Extend> ea=ra;
}
/* But works fine with
Object a;
main()
{
Handle<ObjectReferenced,Reference> ra=a;
Handle<Object,Extend> ea=ra;
}
*/
More information about the Gcc-bugs
mailing list