Description
Brief Description
When a header includes an enum with an implicit value representation such as the following:
enum myEnum {
myVal = 0xffffffff;
};
The BuiltinType
of the generated Enumeration
declaration is erroneously int
and the correpsonding item is incorrect (it's (ulong)(int)0xffffffff
).
After some digging, it appears the code responsible for setting the type is:
CppSharp/src/CppParser/Parser.cpp
Lines 2990 to 2994 in 166e45e
int
is returned by getIntegerType
and the items are being incorrectly represented as above.
It appears EnumDecl
is a type directly provided by clang, so this appears to be a bug in clang?
Explicitly specifying the value representation makes everything work as expected.
This is especially odd considering that the clang compiler correctly increases the underlying type's size (and uses unsigned int
unless negative values are present):
https://godbolt.org/z/K8neMYrYT
OS: Windows 10
Target: MSVC