Opened 5 years ago
#200 new defect
Polymorphic Function Pointers not handled by Constructor
Reported by: | ajbeach | Owned by: | |
---|---|---|---|
Priority: | major | Component: | cfa-cc |
Version: | 1.0 | Keywords: | |
Cc: |
Description
There seems to be an issue with function pointers in constructors if the argument or return type is a polymorphic type with an otype type variable (error disappears with dtype). A pointer to the polymorphic type seems to work just fine.
Code:
forall(otype T) struct tag {}; forall(otype U) struct object { void (*function1)(tag(U)); tag(U) (*function2)(); };
Error:
bug.cfa: In function '_X12_constructorQ1_0_0_4__X16_operator_assignFBD0_BD0BD0__X12_constructorFv_BD0__X12_constructorFv_BD0BD0__X11_destructorFv_BD0__Fv_S6object_BD0_Fv_S3tag_BD0___autogen___1': bug.cfa:24:259: warning: assignment to 'void (*)(long unsigned int, long unsigned int, void *)' from incompatible pointer type 'void (*)(void *)' [-Wincompatible-pointer-types] 24 | void (*function1)(tag(U)); | bug.cfa: In function '_X12_constructorQ1_0_0_4__X16_operator_assignFBD0_BD0BD0__X12_constructorFv_BD0__X12_constructorFv_BD0BD0__X11_destructorFv_BD0__Fv_S6object_BD0_Fv_S3tag_BD0__FS3tag_BD0____autogen___1': bug.cfa:24:259: warning: assignment to 'void (*)(long unsigned int, long unsigned int, void *)' from incompatible pointer type 'void (*)(void *)' [-Wincompatible-pointer-types] 24 | void (*function1)(tag(U)); |
Also I was not able to get this error message to appear anywhere but the constructor. I tried several types and although it is not an exhaustive search it didn't turn up anything.
Note: See
TracTickets for help on using
tickets.