I'm trying to forward declare a class with the _may_alias attribute, but GCC gives an error when I attempt to do so:
struct __attribute__((__may_alias__)) MyType;
MyType* foo();
typedef struct __attribute__((__may_alias__)) MyType { ... } MyType;
MyType* foo() {}
Gives the error:
testc.c:4: error: redefinition of typedef ‘A’
testc.c:1: note: previous declaration of ‘A’ was here
testc.c:5: error: conflicting types for ‘foo’
testc.c:2: note: previous declaration of ‘foo’ was here
Is there a way to do this?