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 | c82fae60707a93dc73b6788528d451b1212876e3 (patch) | |
tree | 7368c7f4f146ec997ddff44edb662f6ad1d354ec /clang/lib | |
parent | 4daa67483dbafbbcc94b27646b913851c2307910 (diff) | |
download | bcm5719-llvm-c82fae60707a93dc73b6788528d451b1212876e3.tar.gz bcm5719-llvm-c82fae60707a93dc73b6788528d451b1212876e3.zip |
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).
llvm-svn: 149796
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index f84c6347cb0..bb7042d1954 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/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); } |