EGCS 1.1a: unreasonable/incorrect casting restriction

Keith Hanlan keithh@nortel.ca
Thu Sep 3 10:09:00 GMT 1998


A change has been made to the casting rules in EGCS 1.1a
since EGCS 1.03a. Previously, the following code compiled
without problem.

Given:
   typedef void (*Deleter)(void*);
   template <class X, Deleter deleter = free> 
      class MyAutoPtr
      {...}
   void OVwDbFreeFieldValue(OVwFieldValue *fieldValue);

The following three semantically identical lines all
produce the same error:
typedef MyAutoPtr <OVwFieldValue, 
		   OVwDbFreeFieldValue> OVwFieldValue_auto_ptr;

typedef MyAutoPtr <OVwFieldValue, 
		   reinterpret_cast<Deleter>(OVwDbFreeFieldValue)> 
		                        OVwFieldValue_auto_ptr;
typedef MyAutoPtr <OVwFieldValue, 
		   (Deleter)OVwDbFreeFieldValue> 
		                        OVwFieldValue_auto_ptr;

Now EGCS 1.1a complains:
/rbbvobs/xems/include/ovobject.hh:171: could not convert template argument `OVwDbFreeFieldValue(OVwFieldValue *)' to `void (*)(void *)'

Why not?

I can't find anything in the December 1996 draft that precludes this
syntax. I'm assuming that §3.9.2.4 still says "A void* shall be able
to hold any object pointer".

Is this a bug or do I need to use subclasses?

Thanks,
Keith Hanlan    KeithH@nortel.ca   NORTEL Ottawa, Canada  1-613-765-4645



More information about the Gcc-bugs mailing list