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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271762
91177308-0d34-0410-b5e6-
96231b3b80d8
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.
--- /dev/null
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -std=c++11 -x c++ %s
+
+typedef __SIZE_TYPE__ size_t;
+template <typename _Tp, size_t _Nm> struct array { _Tp _M_elems[_Nm]; };
+template <typename T> struct s {
+ array<int, 1> v{static_cast<int>(sizeof (T) / sizeof(T))};
+};
+