diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-04-06 22:40:38 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-04-06 22:40:38 +0000 |
commit | d2008e2c80d6c9282044ec873a937a17a0f33579 (patch) | |
tree | d3e119b536c83e6fd769fa31a3abac02892a2aed /lib/AST/ExprConstant.cpp | |
parent | e35abe1fd3f867ae51d5c68d98578d537eb6beca (diff) |
Implement support for null non-type template arguments for non-type
template parameters of pointer, pointer-to-member, or nullptr_t
type in C++11. Fixes PR9700 / <rdar://problem/11193097>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154219 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r-- | lib/AST/ExprConstant.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 0d8490e137..4ef169d189 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -1743,8 +1743,10 @@ static bool HandleLValueToRValueConversion(EvalInfo &Info, const Expr *Conv, // parameters are constant expressions even if they're non-const. // In C, such things can also be folded, although they are not ICEs. const VarDecl *VD = dyn_cast<VarDecl>(D); - if (const VarDecl *VDef = VD->getDefinition(Info.Ctx)) - VD = VDef; + if (VD) { + if (const VarDecl *VDef = VD->getDefinition(Info.Ctx)) + VD = VDef; + } if (!VD || VD->isInvalidDecl()) { Info.Diag(Conv); return false; |