From 24e53f4f79daf0a87200c675342ffeca59b5bc17 Mon Sep 17 00:00:00 2001 From: Joao Matos <joao@tritao.eu> Date: Mon, 15 Feb 2016 21:26:04 +0000 Subject: [PATCH] Fixed expression parsing of dependent type default unary expressions. Fixes issue #618. --- src/CppParser/Parser.cpp | 1 + tests/Common/Common.h | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/CppParser/Parser.cpp b/src/CppParser/Parser.cpp index bda9165d..a1a6e607 100644 --- a/src/CppParser/Parser.cpp +++ b/src/CppParser/Parser.cpp @@ -2693,6 +2693,7 @@ AST::Expression* Parser::WalkExpression(clang::Expr* Expr) llvm::APSInt integer; if (Expr->getStmtClass() != Stmt::CharacterLiteralClass && Expr->getStmtClass() != Stmt::CXXBoolLiteralExprClass && + Expr->getStmtClass() != Stmt::UnaryExprOrTypeTraitExprClass && Expr->EvaluateAsInt(integer, C->getASTContext())) return new AST::Expression(integer.toString(10)); return new AST::Expression(GetStringFromStatement(Expr)); diff --git a/tests/Common/Common.h b/tests/Common/Common.h index b356656e..e5943604 100644 --- a/tests/Common/Common.h +++ b/tests/Common/Common.h @@ -1038,6 +1038,11 @@ void TemplateWithVirtual<T>::v() { } +template <typename T> +int FunctionTemplateWithDependentTypeDefaultExpr(size_t size = sizeof(T)) { + return size; +} + class DLL_API DerivedFromTemplateInstantiationWithVirtual : public TemplateWithVirtual<int> { public: