diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-06-04 03:16:21 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-06-04 03:16:21 +0000 |
commit | ada78feb08e1924c4f18fa91b6f30627733a4aba (patch) | |
tree | 7babc7fcdba1570105d79a5a7c8f27cea69ec7a7 /clang/lib/AST/ExprConstant.cpp | |
parent | 1c1101bb331c5b242bdf31a57bcb9dfd80e30e9b (diff) | |
download | bcm5719-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.cpp | 5 |
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. |