# V1117. The declared function type is cv-qualified. The behavior when using this type is undefined.

The analyzer has detected a declared function type with the `const` or `volatile` qualifiers in C code. Using these types leads to undefined behavior, as specified in Clause 10 of Paragraph 6.7.4.1 in C23.

The code example where the analyzer issues warnings:

    typedef int fun_t(void);

    typedef const fun_t const_qual_fun_t;          // V1117

    typedef const fun_t * ptr_to_const_qual_fun_t; // V1117

    void foo()
    {
      const fun_t c_fun_t;       // V1117
      const fun_t * ptr_c_fun_t; // V1117
    }

To ensure proper functionality, the `const` qualifier should be removed when declaring the function type. The fixed code looks like this:

    typedef int fun_t(void);

    typedef fun_t const_qual_fun_t;          // ok

    typedef fun_t * ptr_to_const_qual_fun_t; // ok

    void foo()
    {
      fun_t c_fun_t;       // ok
      fun_t * ptr_c_fun_t; // ok
    }