Commit Graph

227 Commits

Author SHA1 Message Date
IOBYTE 2482873029
fix location of forward declaration of specialized template (#3031) 2021-01-09 20:00:35 +01:00
IOBYTE 503a5dd441
fix #10081 (Hang: TemplateSimplifier::useDefaultArgumentValues) (#3021) 2021-01-06 23:06:50 +01:00
IOBYTE e7bdf5f71c
remove cleanupAfterSimplify from the template simplifier (#2998)
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>
2020-12-31 09:33:23 +01:00
IOBYTE 277da763aa
fix #10054 (debug: Executable scope 'x' with unknown function.) (#2994) 2020-12-30 08:09:34 +01:00
IOBYTE 7fc03c6030
fix #10032 (Syntax error if first function in a struct is a template function) (#2940)
Co-authored-by: Robert Reif <reif@FX6840>
2020-12-11 07:01:20 +01:00
IOBYTE 8d9f0b3528
fix #9394 ("debug: Executable scope 'x' with unknown function." with … (#2935) 2020-12-06 22:08:42 +01:00
IOBYTE ab16603666
fix #9685 (Handle 'extern "C++"') (#2933) 2020-12-05 09:26:11 +01:00
IOBYTE 9c51d4c12d
instantiate nested templates in the proper order (#2930) 2020-12-04 08:04:16 +01:00
IOBYTE 2bbc7abedc
fix overloaded function lookup for explicit instantiations (#2929) 2020-12-01 09:43:16 +01:00
Daniel Marjamäki 9aa69661b5 More robust Token::findClosingBracket 2020-11-30 19:26:28 +01:00
Daniel Marjamäki 8a1c16a560 Tokenizer: add daca debug messages when right angle brackets in templates are not handled well 2020-11-29 16:07:56 +01:00
Daniel Marjamäki e2debac882 Fix testcases 2020-11-29 08:46:42 +01:00
IOBYTE 1ea89bcad8
add support for template constructors (#2911) 2020-11-24 07:21:37 +01:00
Daniel Marjamäki 4a2e082d85 Revert "GUI: restore default tab in ProjectFileDialog"
This reverts commit 39564c9e6c.
2020-11-23 20:18:06 +01:00
Daniel Marjamäki 39564c9e6c GUI: restore default tab in ProjectFileDialog 2020-11-23 19:27:14 +01:00
Daniel Marjamäki 2cd8ea83a7 Fixed #9860 (unused template not removed properly by default) 2020-11-22 16:43:36 +01:00
IOBYTE c4b3d4cd77
fix #9983 (TemplateSimplifier: template not simplified : f(0,0);) (#2905)
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>
2020-11-17 06:51:32 +01:00
IOBYTE e785885b4d
fix #9975 (Template method not simplified) (#2894) 2020-11-10 21:19:04 +01:00
Robert Reif a52ce7379a fix #9886 (Hang in TemplateSimplifier (gcc/gcc/testsuite/g++.dg/cpp0x/decltype34.C)) 2020-09-10 14:47:59 -04:00
IOBYTE 2106e30304
fix template namespace bug (#2780)
Co-authored-by: Robert Reif <reif@FX6840>
2020-09-07 17:45:19 +02:00
IOBYTE 2db0d2878b
fix daca crash in TemplateSimplifier::getNewName (#2772)
Don't add the same template instantiation multiple times.

Co-authored-by: Robert Reif <reif@FX6840>
2020-09-04 07:08:28 +02:00
Daniel Marjamäki bb5cad42cd astyle formatting
[ci skip]
2020-08-26 10:15:09 +02:00
IOBYTE 7cf3909275
fix #9854 (Syntax error on valid C++ code) (#2756) 2020-08-26 07:00:58 +02:00
shaneasd 45fc6a0eeb
Test for syntax error in nested templates (#2746) 2020-08-25 07:14:44 +02:00
Ken-Patrick Lehrmann 5c1a2db434 Fix handling of c++ casts in template expansion
Cast were not expanded properly: the `<` was not taken into account in
typeindentlevel, so we would then miss a `>`, resulting in syntaxError.
2020-06-16 19:36:04 +02:00
Oliver Stöneberg 4f68d85633
optimized non-matchcompiled Token::simpleMatch() a bit (#2640) 2020-05-26 20:13:56 +02:00
Daniel Marjamäki 08ddd84780 Update copyright year 2020-05-10 11:16:32 +02:00
Daniel Marjamäki 3e0218299b Revert "Update copyright year"
This reverts commit 6eec6c4bd5.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki 6eec6c4bd5 Update copyright year 2020-05-10 11:11:34 +02:00
Daniel Marjamäki 97b04ba9a7 Syntax check: Using keyword in global scope 2020-04-11 17:36:22 +02:00
Daniel Marjamäki 8dd0a9241c TemplateSimplifier: Simplification of const types 2020-04-05 13:51:58 +02:00
IOBYTE 4d58d9fc87
fix daca chromium crash (#2527) 2020-02-09 11:19:36 +01:00
Dmitry-Me 84f65c40a7 Improve test coverage for templates with comparison in default value 2020-02-03 18:36:51 +03:00
IOBYTE 0e4efea530 fix #9539 (Syntax error for valid C++14 code) (#2446) 2019-12-12 20:50:20 +01:00
IOBYTE f554a71dea fix #9495 (Crash when parsing angle brackets in template with type traits (assertion failure)) (#2407) 2019-11-29 09:44:27 +01:00
IOBYTE 590aeea8f8 Fix #9483 (Assertion `tok && tok->str() == ">"' failed) (#2381) 2019-11-20 07:02:25 +01:00
IOBYTE f88ae21d8f Fix #9467 (False positive on local variable when template specialization is used) (#2357) 2019-11-13 21:34:27 +01:00
IOBYTE 02e7f4f61c Fix template templates where the template template parameter is not the first parameter. (#2309) 2019-10-30 12:12:47 +01:00
IOBYTE c32a568c1f fix #8965 ("(debug) Executable scope 'x' with unknown function." with rvalue parameter in method) (#2237)
I fixed the AST enough to pass testrunner but I don't believe it is
correct.

This code:

void Foo4(int&&b);

has this AST:

( 'void'
|-Foo4
`-&& 'bool'
  |-int
  `-b 'signed int'

but I don't believe && should have `bool`.
2019-10-04 12:30:11 +02:00
IOBYTE 3e17c24dd8 fix syntax error on template operator (#2225) 2019-10-03 12:26:45 +02:00
IOBYTE d0968a1377 Warn about unknown macro causing template syntax error (#2222) 2019-09-26 16:01:01 +02:00
IOBYTE 4475c4c7e2 template simplifier: fix syntax error (#2218) 2019-09-26 10:31:19 +02:00
IOBYTE 12f93b63a8 template simplifier: fix simplification of "< %num% %comp% %num% >" (#2214)
* template simplifier: fix simplification of "< %num% %comp% %num% >"

* fix test to not fail on 32 bit platforms
2019-09-25 12:06:29 +02:00
Oliver Stöneberg 9028b4a81d do not access static methods through instance (#2189) 2019-09-20 21:54:30 +02:00
IOBYTE 8c5cf8c029 Fixed #9046 syntaxError (#2180)
* Fixed #9046 syntaxError

* fix another syntax error

* fix some more syntax errors
2019-09-20 12:35:01 +02:00
IOBYTE 4e222afa2c template simplifier: ignore alias template definitions with syntax errors (#2169)
Is not allowed to define a type in an alias template definition.

This code:

template<int N>
using A1 = struct B1 { static auto constexpr value = N; };
A1<0> a1;

produces this output:

2: } ;
3: struct B1 { static const auto value = 0 a1 ;

test.cpp:2:57: error: Analysis failed. If the code is valid then please
report this failure. [cppcheckError]
using A1 = struct B1 { static auto constexpr value = N; };
                                                        ^

because it tries to instantiate the invalid alias template definition
and generates garbage code.
2019-09-11 19:31:15 +02:00
IOBYTE 639c29eb5c Fix #9338 (Regression: Syntax error on valid C++) (#2156)
* Fix #9338 (Regression: Syntax error on valid C++)

* fix cppcheck warning
2019-09-09 21:46:21 +02:00
IOBYTE 59fdbd8435 Fix #9337 (Syntax error on valid C++) (#2152) 2019-09-07 09:09:04 +02:00
IOBYTE e5220bdf0c make ellipsis ... a single token (#2143)
* make ellipsis ... a single token

Using cppcheck -E to preprocess code with ellipsis produces output that
can't be compiled because ... is split into 3 tokens.

* try to fix addon
2019-09-04 08:07:30 +02:00
IOBYTE fd403bf7e6 template simplifier: only add recursive instantiation if its arguments are a constant expression (#2138) 2019-09-02 06:51:19 +02:00