c++17 fold expressions are simplified to a __cppcheck_uninstantiated_fold__ if they are not instantiated.
c++20 concepts are skipped/removed by Cppcheck and these will be enforced by the compiler.
This only fixes the crash. The templates that are instantiated are
correct but one template is left uninstantiated. Fixing the missing
instantiation is not easy and will be looked at later.
Co-authored-by: Robert Reif <reif@FX6840>
It is necessary to use a fake NameAndToken in
mTypesUsedInTemplateInstantiation rather than a Token pointer so the
template simplifiers internal state is kept valid when tokens are
deleted. This prevents a use after free.
Co-authored-by: Robert Reif <reif@FX6840>
* small template simplifier optimization
* don't look for template parameter name in default values
* fix cppcheck warning
* add test for TemplateSimplifier::getTemplateParametersInDeclaration()
Also removed TemplateSimplifier::getTemplateParametersInDeclaration()
return value since it wasn't used.
* added another test
Co-authored-by: Robert Reif <reif@FX6840>
The template simplifier works well enough now so cleanupAfterSimplify is
no longer necessary. In fact cleanupAfterSimplify was introducing a bug
which improperly simplified C++ style casts.
Bugs should be exposed and fixed properly rather than just hiding them.
Co-authored-by: Robert Reif <reif@FX6840>
Currently template type deduction for functions only works for single
template argument single function argument functions with a literal
argument.
This patch starts to add support for single template argument multiple
function argument functions. It correctly handles functions with
multiple arguments of the same type. It also handles a mix of template
and non-template arguments.
It does not add support for overloading non-template arguments.
It does not add support for multiple parameter template functions.
It does not add support for type deduction from variable arguments.
Co-authored-by: Robert Reif <reif@FX6840>