diff options
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r-- | lib/AST/ExprConstant.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index f84c6347cb..bb7042d195 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -1560,7 +1560,8 @@ static bool AreElementsOfSameArray(QualType ObjType, /// \param Info - Information about the ongoing evaluation. /// \param Conv - The expression for which we are performing the conversion. /// Used for diagnostics. -/// \param Type - The type we expect this conversion to produce. +/// \param Type - The type we expect this conversion to produce, before +/// stripping cv-qualifiers in the case of a non-clas type. /// \param LVal - The glvalue on which we are attempting to perform this action. /// \param RVal - The produced value will be placed here. static bool HandleLValueToRValueConversion(EvalInfo &Info, const Expr *Conv, @@ -2536,7 +2537,9 @@ public: if (!EvaluateLValue(E->getSubExpr(), LVal, Info)) return false; CCValue RVal; - if (!HandleLValueToRValueConversion(Info, E, E->getType(), LVal, RVal)) + // Note, we use the subexpression's type in order to retain cv-qualifiers. + if (!HandleLValueToRValueConversion(Info, E, E->getSubExpr()->getType(), + LVal, RVal)) return false; return DerivedSuccess(RVal, E); } |