Menu

Compiler error in checkunusedfunctions.cpp::updateFunctinData()

2024-05-23
2024-05-23
  • Steve Matty

    Steve Matty - 2024-05-23

    (sorry, typo in topic should read updateFunctionData())

    Compiling with GNU GCC 4.8.2 gives a (IMHO correct) error on the line

    mFunctionDecl.insert(mFunctionDecl.cend(), check.mFunctionDecl.cbegin(), check.mFunctionDecl.cend());

    Error:

    lib/checkunusedfunctions.cpp: In member function void CheckUnusedFunctions::updateFunctionData(const CheckUnusedFunctions&):
    lib/checkunusedfunctions.cpp:474:104: error: no matching function for call to std::list<CheckUnusedFunctions::FunctionDecl>::insert(std::list<CheckUnusedFunctions::FunctionDecl>::const_iterator, std::list<CheckUnusedFunctions::FunctionDecl>::const_iterator, std::list<CheckUnusedFunctions::FunctionDecl>::const_iterator)
         mFunctionDecl.insert(mFunctionDecl.cend(), check.mFunctionDecl.cbegin(), check.mFunctionDecl.cend());
    

    I believe the error is correct, because you can't insert using a const iterator as the insertion point.
    Changing the offending line to
    mFunctionDecl.insert(mFunctionDecl.end(), check.mFunctionDecl.cbegin(), check.mFunctionDecl.cend());
    allows a succesful build

     

    Last edit: Steve Matty 2024-05-23
  • CHR

    CHR - 2024-05-23

    https://en.cppreference.com/w/cpp/container/list/insert begs to differ.
    GCC 4.8.2 is from 2013, so I suspect there is some issue with its STL implementation.

     
  • Steve Matty

    Steve Matty - 2024-05-23

    I stand corrected - thanks for the super-quick response !

     

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.