diff --git a/c2rust-ast-exporter/src/AstExporter.cpp b/c2rust-ast-exporter/src/AstExporter.cpp index 63b8a2ceb4..bd02943d33 100644 --- a/c2rust-ast-exporter/src/AstExporter.cpp +++ b/c2rust-ast-exporter/src/AstExporter.cpp @@ -2213,8 +2213,12 @@ class TranslateASTVisitor final // 2. Encode bitfield width if any if (D->isBitField()) { - cbor_encode_uint( - array, D->getBitWidthValue(*this->Context)); +#if LLVM_VERSION_MAJOR >= 20 + const auto bitWidthValue = D->getBitWidthValue(); +#else + const auto bitWidthValue = D->getBitWidthValue(*this->Context); +#endif + cbor_encode_uint(array, bitWidthValue); } else { cbor_encode_null(array); };