Menu

There is an error message when calling typeof() on a structure member

2022-04-28
2022-05-01
  • Dotan Barak

    Dotan Barak - 2022-04-28

    Hi.

    I got the following error message for the following code sample:
    sample.c:12:24: error: Syntax Error: AST broken, 'tmp' doesn't have a parent. [internalAstError]

    In the code sample below, it seems that calling typeof on a variable is passing, but calling typeof on a structure member causes an error message.

    #include <stdint.h>
    
    struct temp_t {
            uint32_t X;
    };
    
    int main()
    {
            uint32_t X;
            struct temp_t tmp = {};
            uint64_t Y1 = (typeof(X))1;
            uint64_t Y2 = (typeof(tmp.X))1;
            return 0;
    }
    
     
  • CHR

    CHR - 2022-04-28

    I think this is covered by https://trac.cppcheck.net/ticket/10739

     
  • Dotan Barak

    Dotan Barak - 2022-04-28

    Thanks for the fast response
    :)

    I took the master of cppcheck and i still see this failure.
    Is this expected?

     

    Last edit: Dotan Barak 2022-04-28
  • CHR

    CHR - 2022-04-28

    I would say so, since the ticket is still open.

     
  • Dotan Barak

    Dotan Barak - 2022-05-01

    ok, thanks

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.