From 1cf7feac7f768060bea95d769328db24bb6c83f2 Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Mon, 6 Mar 2023 11:04:33 -0800 Subject: [PATCH] Don't attempt to convert constant value if it doesn't exist --- c2rust-ast-exporter/src/AstExporter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/c2rust-ast-exporter/src/AstExporter.cpp b/c2rust-ast-exporter/src/AstExporter.cpp index b451127cc3..610f9d5ec8 100644 --- a/c2rust-ast-exporter/src/AstExporter.cpp +++ b/c2rust-ast-exporter/src/AstExporter.cpp @@ -585,6 +585,8 @@ class TranslateASTVisitor final Expr::EvalResult eval_result; #endif // CLANG_VERSION_MAJOR bool hasValue = E->EvaluateAsInt(eval_result, *Context); + if (!hasValue) + return false; #if CLANG_VERSION_MAJOR < 8 constant = eval_result; #else