Menu

false-positive unreadVariable when variable is used in template

2025-03-17
2025-03-17
  • Rob Deckers

    Rob Deckers - 2025-03-17

    with Cppcheck 2.17 (and earlier) I get a false-positive
    FilterTest.cpp:65:18: style: Variable 'window_size' is assigned a value that is never used. [unreadVariable]

    TEST(FilterTest, MedianTest)
    {
        const size_t window_size = 3;  // Odd number
        Filter::Median<double, window_size> median;
        // rest of test
      }
    

    Median definition is

    template <typename T, std::size_t WindowSize>
        requires(WindowSize % 2 != 0)
    class Median : public IFilter<T>
    
     
  • CHR

    CHR - 2025-03-17
     

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.