diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-01 02:39:43 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-01 02:39:43 +0000 |
commit | b04035a7b1a3c9b93cea72ae56dd2ea6e787bae9 (patch) | |
tree | 72d05deb2369a6fd6bfc370f45037bcfc3314184 /lib/AST/ExprConstant.cpp | |
parent | b02e4629f78a0c0c0adf9d66b644e5932a781c7e (diff) |
constexpr: require 'this' to point to an object in a constexpr method call.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149467 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r-- | lib/AST/ExprConstant.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 8897667592..0f8de63bba 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -127,7 +127,8 @@ namespace { // The order of this enum is important for diagnostics. enum CheckSubobjectKind { - CSK_Base, CSK_Derived, CSK_Field, CSK_ArrayToPointer, CSK_ArrayIndex + CSK_Base, CSK_Derived, CSK_Field, CSK_ArrayToPointer, CSK_ArrayIndex, + CSK_This }; /// A path from a glvalue to a subobject of that glvalue. @@ -2362,6 +2363,9 @@ public: } else return Error(E); + if (This && !This->checkSubobject(Info, E, CSK_This)) + return false; + const FunctionDecl *Definition = 0; Stmt *Body = FD->getBody(Definition); APValue Result; |