diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-10-29 21:53:17 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-10-29 21:53:17 +0000 |
commit | b78c0b66481a59dbef7ac2a454e4f89448909749 (patch) | |
tree | e03e66189d9e3d84c21e85f1c923451db74bac11 /lib/AST/ExprConstant.cpp | |
parent | 47a1eed1cdd36edbefc318f29be6c0f3212b0c41 (diff) |
constexpr evaluation: allow lvalue-to-rvalue conversion on any literal type, not
just integers and floating point types. Since we don't support evaluating class
types or performing lvalue-to-rvalue conversions on array elements yet, this
just means pointer types right now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143298 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r-- | lib/AST/ExprConstant.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 31fddb6248..e5bff359f8 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -457,9 +457,6 @@ bool HandleLValueToRValueConversion(EvalInfo &Info, QualType Type, // parameters are constant expressions even if they're non-const. // In C, such things can also be folded, although they are not ICEs. // - // FIXME: Allow folding any const variable of literal type initialized with - // a constant expression. For now, we only allow variables with integral and - // floating types to be folded. // FIXME: volatile-qualified ParmVarDecls need special handling. A literal // interpretation of C++11 suggests that volatile parameters are OK if // they're never read (there's no prohibition against constructing volatile @@ -467,7 +464,7 @@ bool HandleLValueToRValueConversion(EvalInfo &Info, QualType Type, // them are not permitted. const VarDecl *VD = dyn_cast<VarDecl>(D); if (!VD || !(IsConstNonVolatile(VD->getType()) || isa<ParmVarDecl>(VD)) || - !(Type->isIntegralOrEnumerationType() || Type->isRealFloatingType()) || + !Type->isLiteralType() || !EvaluateVarDeclInit(Info, VD, LVal.CallIndex, RVal)) return false; |