Menu ▾ ▴

#659 Better diagnostic messages for function pointer casts

open
nobody
None
5
2026-05-03
2020-01-14
No

Implicit and perhaps even explicit casts from function pointer types to object pointer types during array initialization should ideally produce a warning message.

See also: Feature request #598

Discussion

  • Philipp Klaus Krause

    There apparently are more cases where the warning (most ports) / error (for large model on stm8) is missing. I just tried to compile

    extern void *p;
    
    void f(void)
    {
        p = &f;
    }
    
    void *p = &f;
    
    void (*fp)(void);
    
    void g(void)
    {
        p = fp;
    }
    

    Out of the three, p = fp is the only one on which I get the expected warning / error.

    Philipp

     
  • Philipp Klaus Krause

    This still applies as of [r16497], and might be related to [bugs:#3952].

     

    Related

    Bugs: #3952
    Commit: [r16497]


Log in to post a comment.