[Bug c/27065] error: array type has incomplete element type

rdabrowa at poczta dot onet dot pl gcc-bugzilla@gcc.gnu.org
Thu Apr 6 19:09:00 GMT 2006



------- Comment #2 from rdabrowa at poczta dot onet dot pl  2006-04-06 19:09 -------
(In reply to comment #1)
> This is invalid code, yes it might had been accepted before 4.1.0 but it was
> still invalid code.  The array to pointer decay happens after the type is
> completed for functions so the element of the array type has to be complete
> still.
> 
What happens ?
Consider the following code:
    struct foo {
        void (*pf)();
    };
Later I can write:
    void f(struct foo (*ptr)[2]);
    struct foo x;
    x.pf = f;
This compiles fine, but now I can assign any function to pf. Why I can't
specify required function prototype ? I can't understand this. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27065



More information about the Gcc-bugs mailing list