Skip to content

Commit 960b35c

Browse files
treat int8_t and uint8_t as special cases (#167)
resolving them yields `char`, but we want to treat them as `int`s therefore we treat them as special cases
1 parent c0ed57d commit 960b35c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

clingwrapper/src/clingwrapper.cxx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,25 @@ Cppyy::TCppType_t Cppyy::ResolveEnumPointerType(TCppType_t type) {
485485
return type;
486486
}
487487

488+
Cppyy::TCppType_t int_like_type(Cppyy::TCppType_t type) {
489+
Cppyy::TCppType_t check_int_typedefs = type;
490+
if (Cpp::IsPointerType(check_int_typedefs))
491+
check_int_typedefs = Cpp::GetPointeeType(check_int_typedefs);
492+
if (Cpp::IsReferenceType(check_int_typedefs))
493+
check_int_typedefs = Cpp::GetReferencedType(check_int_typedefs);
494+
495+
if (Cpp::GetTypeAsString(check_int_typedefs) == "int8_t" || Cpp::GetTypeAsString(check_int_typedefs) == "uint8_t")
496+
return check_int_typedefs;
497+
return nullptr;
498+
}
499+
488500
Cppyy::TCppType_t Cppyy::ResolveType(TCppType_t type) {
489501
if (!type) return type;
490502

503+
TCppType_t check_int_typedefs = int_like_type(type);
504+
if (check_int_typedefs)
505+
return type;
506+
491507
Cppyy::TCppType_t canonType = Cpp::GetCanonicalType(type);
492508

493509
if (Cpp::IsEnumType(canonType)) {
@@ -502,6 +518,9 @@ Cppyy::TCppType_t Cppyy::ResolveType(TCppType_t type) {
502518
}
503519

504520
Cppyy::TCppType_t Cppyy::GetRealType(TCppType_t type) {
521+
TCppType_t check_int_typedefs = int_like_type(type);
522+
if (check_int_typedefs)
523+
return check_int_typedefs;
505524
return Cpp::GetUnderlyingType(type);
506525
}
507526

0 commit comments

Comments
 (0)