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

Using declaration not resolving #128

Closed
deadlocklogic opened this issue Dec 2, 2021 · 1 comment
Closed

Using declaration not resolving #128

deadlocklogic opened this issue Dec 2, 2021 · 1 comment

Comments

@deadlocklogic
Copy link

Consider this:

    cppast::cpp_entity_index _idx;
    cppast::libclang_parser _parser;
    cppast::libclang_compile_config _config;
    auto _file = parse(_idx, "test", R"(
namespace cppast
{
class cpp_template
{
    protected:
    template <class T, class EntityT>
    class basic_builder
    {
    public:
        basic_builder() {}

        basic_builder(basic_builder&&) = default;
    };
};

/// A [cppast::cpp_entity]() modelling a function template.
class cpp_function_template final : public cpp_template
{
public:
    class builder : public basic_builder<void, void>
    {
    public:
        using basic_builder::basic_builder;
    };
};
}
)", true);
    cppast::visit(*_file, [&](const cppast::cpp_entity& e, cppast::visitor_info info) {
        if (info.event != cppast::visitor_info::container_entity_exit) {
            if (e.kind() == cppast::cpp_entity_kind::using_declaration_t) {
                auto& target = dynamic_cast<const cppast::cpp_using_declaration&>(e).target();
                if (target.no_overloaded().get() > 0) {
                    auto refs = target.get(_idx);
                    if (refs.size() > 0) {
                        auto ref = refs[0];
                    }
                }
            }
        }
        return true;
    });

Using declaration using basic_builder::basic_builder; is failing to resolve.
Possible bug, or limitation?

@foonathan
Copy link
Collaborator

This is the same underlying problem as #127: you're referring to basic_builder<void, void>, cppast only knows about basic_builder<T, EntityT> and has no knowledge of connecting the two. I'm closing this as a duplicate.

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