Menu

cppcheckError on chrono_literals

2023-09-08
2023-09-08
  • Pierre DEL PERUGIA

    Hello,

    the following test program produces a cppcheckError error with the for line, but no error with the if nor the 3rd lines.

    #include <chrono>
    
    using namespace std::chrono_literals;
    
    void f( void )
    {
        auto w = 10ms;
    
        for ( bool f = true; f; ) w = 200ms;   // cppcheckError
        // if  ( true  )             w = 200ms;   // no error
        //                           w = 200ms;   // no error
    }
    

    Tested on Ubuntu 22.04 with cppcheck 2.12 dev (48a7a43ef2fbd112c071485eef8a1eb2b806266e of Mon Sep 4 20:05:17 2023 +0200), using the command line:

     --std=c++17
    

    The 3 forms compile with g++ 11.4.0.

     
  • CHR

    CHR - 2023-09-08
     
  • Pierre DEL PERUGIA

    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.