diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h index a93f0f467b18..19cd5d5786bc 100644 --- a/clang/include/clang/AST/Expr.h +++ b/clang/include/clang/AST/Expr.h @@ -647,10 +647,14 @@ public: assert(isArgumentType() && "calling getArgumentType() when arg is expr"); return QualType::getFromOpaquePtr(Argument.Ty); } - Expr* getArgumentExpr() const { + Expr *getArgumentExpr() { assert(!isArgumentType() && "calling getArgumentExpr() when arg is type"); return static_cast(Argument.Ex); } + const Expr *getArgumentExpr() const { + return const_cast(this)->getArgumentExpr(); + } + /// Gets the argument type, or the type of the argument expression, whichever /// is appropriate. QualType getTypeOfArgument() const {