Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FakeIt (w/ doctest) throws template keyword error when compiling (with clang 19) #348

Open
MastermindPanda opened this issue Dec 13, 2024 · 1 comment

Comments

@MastermindPanda
Copy link

Used versions

FakeIt: Generated: 2023-04-17 21:28:50.758101

Doctest : 2.4.11

Clang:

clang version 19.1.4
Target: i686-w64-windows-gnu
Thread model: posix

Issue

When compiling my unit tests with clang 19 (switched from older clang version), the following error occurs:

../tools/fakeit/fakeit.hpp:7924:46: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
 7924 |                 ParamWalker<N - 1>::template Assign(arg_vals, std::forward<arglist>(args)...);

My analysis

The problem has to do with template being improperly used?

A similar issue is discussed here: llvm/llvm-project#94194
It's stated that the issue is not with clang as it follows the standard.

The fix in the mentioned lib issue removes as far as I understand the template keyword before methods (of a template) being called.

In my local fakeIt copy, I removed the template keyboard
ParamWalker<N - 1>::Assign(arg_vals, std::forward<arglist>(args)...);
and my code builds again.

The line is still the same in latest version on github: https://github.com/eranpeer/FakeIt/blob/master/single_header/doctest/fakeit.hpp#L7924

Conclusion

This single change fixes my problem, but I think there are more occurences, e.g. here: https://github.com/eranpeer/FakeIt/blob/master/single_header/doctest/fakeit.hpp#L6248 or a bit different here https://github.com/eranpeer/FakeIt/blob/master/single_header/doctest/fakeit.hpp#L6248.

Unfortunately I am by not means a template meta programmer to know exactly what needs to be done to fix it completely.

@MastermindPanda MastermindPanda changed the title FakeIt (w/ doctest) throws template keyword error when compiling FakeIt (w/ doctest) throws template keyword error when compiling (with clang 19) Dec 13, 2024
@malcolmdavey
Copy link
Contributor

Feel free to offer a pull request, which may make it quicker to get a fix in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants