diff --git a/include/clad/Differentiator/Compatibility.h b/include/clad/Differentiator/Compatibility.h index efd3d629c..f2265c995 100644 --- a/include/clad/Differentiator/Compatibility.h +++ b/include/clad/Differentiator/Compatibility.h @@ -730,5 +730,11 @@ template bool isa_and_nonnull(const Y* Val) { } #endif +#if CLANG_VERSION_MAJOR < 13 +const auto VK_R = ExprValueKind::VK_RValue; +#else +const auto VK_R = ExprValueKind::VK_PRValue; +#endif + } // namespace clad_compat #endif //CLAD_COMPATIBILITY diff --git a/lib/Differentiator/ConstantFolder.cpp b/lib/Differentiator/ConstantFolder.cpp index b585485a2..daea278fe 100644 --- a/lib/Differentiator/ConstantFolder.cpp +++ b/lib/Differentiator/ConstantFolder.cpp @@ -7,6 +7,7 @@ //----------------------------------------------------------------------------// #include "ConstantFolder.h" +#include "clad/Differentiator/Compatibility.h" #include "clang/AST/ASTContext.h" @@ -148,7 +149,7 @@ namespace clad { dyn_cast(QT)->getDecl()->getIntegerType(), C, APVal); Expr* cast = ImplicitCastExpr::Create( C, QT, clang::CastKind::CK_IntegralCast, Result, nullptr, - clang::ExprValueKind::VK_PRValue, FPOptionsOverride()); + clad_compat::VK_R, FPOptionsOverride()); Result = cast; } else if (QT->isPointerType()) { Result = clad::synthesizeLiteral(QT, C);