1

This std::visit example is not understood by Eclipse CDT yet but it compiles fine with a C++17 compiler.

I mean these lines:

template<class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
template<class... Ts> overloaded(Ts...) -> overloaded<Ts...>;

Eclipse marks these two lines and displays "Syntax error". I was digging through Eclipse settings but I don't find any @suppress directive which would simple suppress a "Syntax error".

My question:
Is the a way how to suppress a "Syntax error"?


The settings Preferences | C/C++ | Code Analysis contain these sections:

  • Coding Style
  • Potential Programming Problems
  • Security Vulnerabilities
  • Syntax and Semantic Erros

The last section contains a more detailed description of an error which can be disabled or suppressed.
Would this section contain "Syntax Error" as it is displayed in the editor then my question doesn't exist. Especially, knowing the CDT cannot be always up-to-date this would help.

Peter VARGA
  • 4,780
  • 3
  • 39
  • 75
  • 1
    Unless you want to change IDE, you unfortunately have to live with it until Eclipse is updated to handle the latest standard (which it unfortunately lags a bit now). – Some programmer dude May 20 '18 at 14:46

2 Answers2

1

There is no mechanism to suppress an individual syntax error (@suppress is a mechanism specific to CodAn (code analysis) errors).

You could suppress all syntax errors by going to Preferences | General | Editors | Text Editors | Annotations, selecting C/C++ Indexer Markers (this is the kind of marker created for syntax errors), and unchecking some or all of the check boxes there.

HighCommander4
  • 50,428
  • 24
  • 122
  • 194
  • First sorry, I didn't mention it in the question but this is unfortunately not an option to me. The _pure_ Syntax error is not listed there which would make it possible to suppress it. – Peter VARGA May 20 '18 at 16:56
  • @AlBundy I'm not sure what you mean by "pure" – HighCommander4 May 20 '18 at 17:05
  • @AlBundy: It sounds to me like you're looking at a different preference page. You seem to be looking at `Preferences | C/C++ | Code Analysis`. I am saying to look at `Preferences | General | Editors | Text Editors | Annotations`. – HighCommander4 May 20 '18 at 17:45
  • Yes, I was mixing up two different points in my comment. Unchecking - as you suggested - some or all of the check boxes is not an option because then a _correct_ "Syntax Error" isn't marked as well. I want to suppress only for the **unrecognized C++17 code** the error marker as I am doing it now extensively with the `@suppress("...")` directive. May be the Eclipse community can reconsider to add the _pure_ "Syntax Error" suppress possibility in one of the next updates as there are still lot of unsupported C++17 features which lead to many error markers. – Peter VARGA May 20 '18 at 17:51
  • @AlBundy: I agree that supporting `@suppress` for syntax errors is a reasonable enhancement request. Please feel free to [file a bug](https://bugs.eclipse.org/bugs/enter_bug.cgi?product=CDT) requesting that this be added. – HighCommander4 May 20 '18 at 18:54
0

The answer from HighCommander4 disables - as I commented - all "Syntax Error" markers which is not intended.

So, for the moment there is no solution to achieve this.

I opened a ticket as HighCommander4 suggested and may be it will be implemented in one of the comming Eclipse updates.

Peter VARGA
  • 4,780
  • 3
  • 39
  • 75