summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2016-06-04 03:16:21 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2016-06-04 03:16:21 +0000
commitada78feb08e1924c4f18fa91b6f30627733a4aba (patch)
tree7babc7fcdba1570105d79a5a7c8f27cea69ec7a7 /clang/lib/AST/ExprConstant.cpp
parent1c1101bb331c5b242bdf31a57bcb9dfd80e30e9b (diff)
downloadbcm5719-llvm-ada78feb08e1924c4f18fa91b6f30627733a4aba.tar.gz
bcm5719-llvm-ada78feb08e1924c4f18fa91b6f30627733a4aba.zip
Sema: do not attempt to sizeof a dependent type
We would attempt to evaluate the sizeof a dependent type to check for an integral overflow. However, because the dependent type is not yet resolved, we cannot determine if the expression would overflow. Report a failure to perform a symbolic evaluation of a constant involving the dependent type. llvm-svn: 271762
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 10192be7bdf..8c24b0333e1 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -2024,6 +2024,11 @@ static bool HandleSizeof(EvalInfo &Info, SourceLocation Loc,
return true;
}
+ if (Type->isDependentType()) {
+ Info.Diag(Loc);
+ return false;
+ }
+
if (!Type->isConstantSizeType()) {
// sizeof(vla) is not a constantexpr: C99 6.5.3.4p2.
// FIXME: Better diagnostic.
OpenPOWER on IntegriCloud