Menu

cppcheck 2.10 internal error for user defined literals

penguish
2023-01-31
2023-01-31
  • penguish

    penguish - 2023-01-31

    Running cppcheck 2.10 on the following code produces
    "Internal Error. MathLib::toLongNumber: input was not completely consumed: 2_Tesla [cppcheckError]"

    #include <iostream>
    
    constexpr double operator"" _Tesla ( unsigned long long b ){
        return b*10000.;
    }
    
    int main(){
      const double f=2_Tesla;
      std::cout<<f<<std::endl;
      return 0;
    }
    
     
  • penguish

    penguish - 2023-01-31

    Environment is centos7; we habitually use gcc 11.2 compiler with c++ 17 std.

     
  • CHR

    CHR - 2023-01-31

    Thanks for reporting, please see this PR: https://github.com/danmar/cppcheck/pull/4701

     

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.