diff --git a/atdna/main.cpp b/atdna/main.cpp index 7acd2c2..5b13d2e 100644 --- a/atdna/main.cpp +++ b/atdna/main.cpp @@ -629,7 +629,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor { } else if (!tsDecl->getName().compare("Seek")) { size_t idx = 0; std::string offsetExprStr; - llvm::APSInt direction(64, 0); + llvm::APSInt direction(64, false); const clang::Expr* directionExpr = nullptr; bool bad = false; for (const clang::TemplateArgument& arg : *tsType) { @@ -649,8 +649,11 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor { offsetExprStr = offsetLiteral.toString(10); } } else { - directionExpr = expr; - if (!expr->isIntegerConstantExpr(direction, context)) { + clang::APValue result; + if (expr->isCXX11ConstantExpr(context, &result)) { + directionExpr = expr; + direction = result.getInt(); + } else { clang::DiagnosticBuilder diag = context.getDiagnostics().Report(expr->getExprLoc(), AthenaError); diag.AddString("Unable to use non-constant direction expression in Athena"); diag.AddSourceRange(clang::CharSourceRange(expr->getSourceRange(), true)); diff --git a/include/athena/Global.hpp b/include/athena/Global.hpp index 502291a..1f0f58a 100644 --- a/include/athena/Global.hpp +++ b/include/athena/Global.hpp @@ -123,7 +123,7 @@ namespace athena { namespace error { enum class Level { Message, Warning, Error, Fatal }; } -enum SeekOrigin { Begin, Current, End }; +enum class SeekOrigin { Begin, Current, End }; enum Endian { Little, Big };