Menu

Failed to compile valid code

valeros
2020-04-21
2020-04-21
  • valeros

    valeros - 2020-04-21

    Hello!

    It looks like I've run into code that Cppcheck is not able to compile. The original code can be found here. I prepared a stripped code snippet:

    #include <stdint.h>
    
    extern "C++"
    template <typename T, typename ...TConstructorArgs>
    T* test (int n, TConstructorArgs... TconstructorArgs)
    {
        /* Index out of bounds */
        int arr[10];
        for(int i=0; i < 11; i++) {
            arr[i] = 0;
        }
    
        return nullptr;
    }
    

    The latest Cppcheck reports the following error message:

    Checking core_esp8266_features.h ...
    Defines:
    Undefines:
    Includes:
    Platform:win64
    core_esp8266_features.h:4:1: error: syntax error [syntaxError]
    template <typename T, typename ...TConstructorArgs>
    

    Cppcheck command

    cppcheck --debug-warnings --language=c++ -v --std=c++20 core_esp8266_features.h

    Thanks in advance!

     

    Last edit: valeros 2020-04-21
  • Daniel Marjamäki

    Thanks! I created this ticket:
    https://trac.cppcheck.net/ticket/9685

     

Log in to post a comment.