Browse Source

Fixed expression parsing of dependent type default unary expressions.

Fixes issue #618.
pull/621/head
Joao Matos 9 years ago
parent
commit
24e53f4f79
  1. 1
      src/CppParser/Parser.cpp
  2. 5
      tests/Common/Common.h

1
src/CppParser/Parser.cpp

@ -2693,6 +2693,7 @@ AST::Expression* Parser::WalkExpression(clang::Expr* Expr) @@ -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));

5
tests/Common/Common.h

@ -1038,6 +1038,11 @@ void TemplateWithVirtual<T>::v() @@ -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:

Loading…
Cancel
Save