Menu

internalAstError with binary operator '='

anoy.
2023-09-12
2023-09-12
  • anoy.

    anoy. - 2023-09-12

    The following simplified code compiles without any issue but causes an 'internalAstError'.
    I've verified it with Cppcheck 2.11 and 2.12.0.

    #include <limits>
    
    template <typename T> T min()
    { return std::numeric_limits<T>::min(); }
    
    class Test
    {
    public:
        using val_ptr = int*;
        void case1(val_ptr = val_ptr()) // Syntax Error: AST broken, binary operator '=' doesn't have two operands.
        { }
    
        void case2()
        {
            int min = ::min<int>(); // under some circumstances, the same internalAstError
            (void)min;
        }
    };
    

    Under some circumstances, the first line in case2 also causes the same internalAstError but I'm not able to reproduce it here for some reason.

     
  • CHR

    CHR - 2023-09-12

    Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/11981

     

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.