I noticed that operators with no arguments in classes fail to parse when a requires clause is used. The current development version also fails to parse this.
Here are two failing minimal examples and one that parses fine.
template <typename T> struct test { operator int() requires true { return 0; } };
example.cpp:2:32: error: syntax error: operator [syntaxError] operator int() requires true { return 0; } ^ Active checkers: There was critical errors
template <typename T> struct test { bool operator()() requires true { return true; } };
example.cpp:4:36: error: syntax error: operator [syntaxError] bool operator()() requires true { return true; } ^ Active checkers: There was critical errors
template <typename T> struct test { bool operator()(int a) requires true { return true; } };
The last one parses fine.
Thanks for reporting, see https://trac.cppcheck.net/ticket/10251
Log in to post a comment.
I noticed that operators with no arguments in classes fail to parse when a requires clause is used. The current development version also fails to parse this.
Here are two failing minimal examples and one that parses fine.
The last one parses fine.
Last edit: dominik nussbaumer 2023-10-10
Thanks for reporting, see https://trac.cppcheck.net/ticket/10251