From aac9415bfbc9a8b1588e6d66842eecb26bc58992 Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Sat, 25 Aug 2007 14:02:58 +0000 Subject: [PATCH] Give CXXBoolLiteralExpr a type (all expressions need a valid type). This fixes the following: ******************** TEST 'Parser/cxx-bool.cpp' FAILED! ******************** Command: clang -fsyntax-only Parser/cxx-bool.cpp Output: SemaExpr.cpp:731: failed assertion `!t.isNull() && "DefaultFunctionArrayConversion - missing type"' Output/cxx-bool.cpp.out.script: line 1: 22697 Abort trap clang -fsyntax-only Parser/cxx-bool.cpp llvm-svn: 41401 --- clang/Sema/SemaExprCXX.cpp | 3 ++- clang/include/clang/AST/ExprCXX.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/clang/Sema/SemaExprCXX.cpp b/clang/Sema/SemaExprCXX.cpp index 74be79aaddf0..be1d551cd67f 100644 --- a/clang/Sema/SemaExprCXX.cpp +++ b/clang/Sema/SemaExprCXX.cpp @@ -13,6 +13,7 @@ #include "Sema.h" #include "clang/AST/ExprCXX.h" +#include "clang/AST/ASTContext.h" using namespace clang; /// ParseCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's. @@ -40,5 +41,5 @@ Action::ExprResult Sema::ParseCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind) { assert((Kind != tok::kw_true || Kind != tok::kw_false) && "Unknown C++ Boolean value!"); - return new CXXBoolLiteralExpr(Kind == tok::kw_true, OpLoc); + return new CXXBoolLiteralExpr(Kind == tok::kw_true, Context.BoolTy, OpLoc); } diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h index c863df4c7608..14b1cc7d3aff 100644 --- a/clang/include/clang/AST/ExprCXX.h +++ b/clang/include/clang/AST/ExprCXX.h @@ -78,8 +78,8 @@ namespace clang { bool Value; SourceLocation Loc; public: - CXXBoolLiteralExpr(bool val, SourceLocation l) : - Expr(CXXBoolLiteralExprClass, QualType()), Value(val), Loc(l) {} + CXXBoolLiteralExpr(bool val, QualType Ty, SourceLocation l) : + Expr(CXXBoolLiteralExprClass, Ty), Value(val), Loc(l) {} bool getValue() const { return Value; }