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
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 10192be..8c24b03 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -2024,6 +2024,11 @@
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.