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

Getting arguments of template instantiation #43

Closed
rokups opened this issue Mar 4, 2018 · 1 comment
Closed

Getting arguments of template instantiation #43

rokups opened this issue Mar 4, 2018 · 1 comment

Comments

@rokups
Copy link
Contributor

rokups commented Mar 4, 2018

I am trying to get templated type parameter. This oversimplified example fails:

if (type.kind() == cppast::cpp_type_kind::template_instantiation_t)
{
    const auto& templateType = dynamic_cast<const cppast::cpp_template_instantiation_type&>(type);
    templateType.arguments().value();    // type_safe/tagged_union.hpp:262: Assertion 'cur_type_ == type' failed - different type stored in union.
}

Am i doing something wrong or is this a bug?

@foonathan
Copy link
Collaborator

See here: https://github.com/foonathan/cppast/blob/master/include/cppast/cpp_template.hpp#L145-L168

In your case the arguments aren't exposed so you only get them as string via unexposed_arguments(). See also #9.

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