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

unable to resolve type alias to enum #521

Open
1 task done
huili80 opened this issue Feb 17, 2024 · 0 comments
Open
1 task done

unable to resolve type alias to enum #521

huili80 opened this issue Feb 17, 2024 · 0 comments
Labels

Comments

@huili80
Copy link

huili80 commented Feb 17, 2024

  • Checked for duplicates

Describe the bug

I originally reported a bug in cppyy, wlav/cppyy#215, but was told it's a Cling issue that it's "unable to resolve the type".

import cppyy
code = """
using type = std::byte; // or any other enum smaller than 4 bytes
type x{};
std::array<char,4> a = {1,2,3,4};
"""
cppyy.cppdef(code)
print(hex(cppyy.gbl.x))
cppyy.gbl.x = 0x0fffffff
print([ord(cppyy.gbl.a[i]) for i in range(4)])
0x3020100
[255, 255, 15, 4]

Expected behavior

0x0
[1, 2, 3, 4]

To Reproduce

The combination of

  • using a type alias to declare a variable
  • type being an enum smaller than 4 bytes

is required to reproduce this behavior.

Setup

cppyy 3.0.0 and 3.1.2.

Additional context

See the bug report in cppyy, wlav/cppyy#215.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant