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

Namespace confusion in type lookup #253

Open
saraedum opened this issue Aug 15, 2024 · 0 comments
Open

Namespace confusion in type lookup #253

saraedum opened this issue Aug 15, 2024 · 0 comments

Comments

@saraedum
Copy link
Contributor

saraedum commented Aug 15, 2024

Consider the following code snippet:

import cppyy

cppyy.cppdef(r"""
namespace X {
    class C {};
}

namespace Y {
    namespace Z {
        template <typename T> void f() {}
    }

    namespace X {
        class D {};
    }
}
""")

cppyy.gbl.Y.Z.f[type(cppyy.gbl.X.C)]()

I would expect this to work (and do nothing) but instead I get:

TypeError: Could not find "f<X::C>" (set cppyy.set_debug() for C++ errors):
  Failed to instantiate "f<X::C>()"

With cppyy.set_debug(), I get:

lookup.funcname.file:1:6: error: no member named 'C' in namespace 'Y::X'
f<X::C>

So the type is translated incorrectly here. It should be ::X::C I guess.


This happened with the latest cppyy (3.1.2) from conda-forge on Linux and also with the cppyy from pip on Linux.

saraedum added a commit to saraedum/cppyythonizations that referenced this issue Aug 15, 2024
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

1 participant