0

While using KDevelop, I reached some code where the Semantic Analyser get crazy: it mostly consider the full header as semantically wrong with ugly red highlighting everywhere.

I simplified to the maximum the code and this is the result:

enter image description here

In case, for testing MyClass.hpp:

#pragma once

#include <memory>
#include <variant>

template <typename Real, typename Index>
using Io = std::variant<Real, Index>;


template <typename Real, typename Index>
struct MyClass
{
    std::shared_ptr<Io<Real, Index>> ioPtr;
};

I can build this code (just add a main function in another file), and thus consider this as valid code.

KDevelop version is the current Debian one: 5.3.1 (not the latest version unfortunately)

Question:

Why is this happening? Is there something that I can do to avoid this? (without changing the code)

Adrian Maire
  • 14,354
  • 9
  • 45
  • 85

1 Answers1

3

In KDevelop, you need to set the parser language version. This is done in Project -> Open configuration -> Language support -> C++ Parser. Then you'll be able to select C++17 as the language version for the parser.

Guillaume Racicot
  • 39,621
  • 9
  • 77
  • 141
  • 1
    That is correct but I find my self changing between Clang and GCC as well sometimes in order to get it work. – Petross404 Dec 15 '21 at 16:12