Skip to content

Conversation

@Vipul-Cariappa
Copy link
Collaborator

@Vipul-Cariappa Vipul-Cariappa commented Nov 28, 2025

requires test:

import cppyy
from cppyy import gbl

cppyy.cppdef(
    r"""
enum What { NO, YES };

template <What E>
struct EE {
    What w = E;
};

template <What E>
What get() {
    return E;
}
"""
)

assert gbl.EE[gbl.What.NO]().w == 0
assert gbl.EE[gbl.What.YES]().w == 1

assert gbl.get[gbl.What.NO]() == 0
assert gbl.get[gbl.What.YES]() == 1

This was discovered while working on ROOT workshop slides.

Vipul-Cariappa added a commit to Vipul-Cariappa/cppyy-compiler-research that referenced this pull request Nov 28, 2025
@Vipul-Cariappa
Copy link
Collaborator Author

Added the test to compiler-research/cppyy#164

}

Cpp::TCppScope_t GetEnumFromCompleteName(const std::string &name) {
std::string delim = "::";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to do string parsing to do a simple-ish lookup.

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

Successfully merging this pull request may close these issues.

2 participants