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

[PARSE BUG]: Explicit instantiations of function templates cannot be parsed #102

Open
asteever opened this issue Aug 14, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@asteever
Copy link

Function templates can be explicitly instantiated (including those with inferred template parameters), but cxxheaderparser will not have it.

Per

tok = self.lex.token_if("class", "struct")
all instantiations must be class or struct, and the TemplateInst type seems to assume this also.

https://en.cppreference.com/w/cpp/language/function_template explicit instantiation

https://coliru.stacked-crooked.com/a/15000b7567cd61ca <- compiles fine

@virtuald
Copy link
Member

Please post an example of the code that can't be parsed in this issue, thanks!

@virtuald virtuald added the question Further information is requested label Aug 14, 2024
@asteever
Copy link
Author

https://coliru.stacked-crooked.com/a/15000b7567cd61ca is the example

#include <iostream>

template <typename T> T tFunction(T val);

template <typename T> T tFunction(T val) {
    return val;
}

template bool tFunction(bool val);

@virtuald virtuald added bug Something isn't working and removed question Further information is requested labels Sep 19, 2024
@virtuald
Copy link
Member

Specifically, template bool tFunction(bool val); doesn't work in cxxheaderparser, but godbolt seems to accept it.

That's a weird declaration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants