diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-05 01:23:16 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-05 01:23:16 +0000 |
commit | 9ec7197796a2730d54ae7f632553b5311b2ba3b5 (patch) | |
tree | b63349457a064e85022334ba47052ff34fb6f74c /lib/AST/ExprConstant.cpp | |
parent | eac1f6746a2915fea3ed42284b07e274c0095a95 (diff) |
constexpr: Fix implementation of DR1311: check for volatile qualifiers in
lvalue-to-rvalue conversions on the source type of the conversion, not the
target type (which has them removed for non-class types).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149796 91177308-0d34-0410-b5e6-96231b3b80d8
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); } |