// Same as std::is_same_v, but can be one of multiple options
template <class t,="" class...="" rest="">
inline constexpr bool is_one_of_v = (std::is_same_v<t, rest=""> || ...);</t,></class>
When trying to parse it, cppcheck produces the following error and stops analyzing the code:
Syntax Error: AST broken, binary operator '=' doesn't have two operands. [id: internalAstError]
I would welcome a fix, since a header with this code is included very often in our solution and therefore renders cppcheck useless.
I can't reproduce your problem with current head using the code below:
#include<iostream>#include<type_traits>// Same as std::is_same_v, but can be one of multiple optionstemplate<classt,class...rest>inlineconstexprboolis_one_of_v=(std::is_same_v<t,rest>||...);intmain(){std::cout<<"Hello World!\n";returnis_one_of_v<double,int,size_t,double>;}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear all,
Cppcheck seems to not understand the code below:
include <iostream></iostream>
include <type_traits></type_traits>
// Same as std::is_same_v, but can be one of multiple options
template <class t,="" class...="" rest="">
inline constexpr bool is_one_of_v = (std::is_same_v<t, rest=""> || ...);</t,></class>
int main()
{
std::cout << "Hello World!\n";
return is_one_of_v<double, int,="" size_t,="" double="">;
}</double,>
When trying to parse it, cppcheck produces the following error and stops analyzing the code:
Syntax Error: AST broken, binary operator '=' doesn't have two operands. [id: internalAstError]
I would welcome a fix, since a header with this code is included very often in our solution and therefore renders cppcheck useless.
Best Regards,
Martin Brieg
PTV GROUP
Software Developement Microscopic Simulation
Haid-und-Neu-Str. 15, 76131 Karlsruhe, Germany
Phone +49 (0) 721 9651-7234
martin.brieg@ptvgroup.com
www.ptvgroup.com
--
Explore the PTV Group in 2 minutes!http://www.youtube.com/watch?v=axifxOS_mFI&feature=youtu.be
Register for the PTV-Newsletterhttp://company.ptvgroup.com/de/news-presse/newsletter/newsletter-abonnement/
Follow us on social media:
Linkedinhttp://ptv.to/linkedin
Twitterhttp://ptv.to/twitter
Xinghttp://ptv.to/xing
Instagramhttps://www.instagram.com/mindofmovement/?hl=de
Facebookhttp://ptv.to/facebook
--
PTV Planung Transport Verkehr AG
Headquarters: Karlsruhe
Executive Board: Christian U. Haas (CEO), Klaus Lechner, Dr. Peter Overmann
Supervisory Board: Dr. Manfred Döss, Martin Korbmacher
Commercial Register (HRB‑Nr): 109262
Local Court: Mannheim
I can't reproduce your problem with current head using the code below:
To me, this happens all the time. I am running on Windows using CppCheck 2.5installer.
Ah, yes. Head works fine. Sorry for not reading your answer correctly. I will use the current build for testing purposes. Thanks for fixing it!