diff options
author | John McCall <rjmccall@apple.com> | 2009-11-04 03:03:43 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-11-04 03:03:43 +0000 |
commit | d00f200f64994858492558b54c6f6f2b3d4b4310 (patch) | |
tree | 181d814ddc8bd8e284c8c3472a09431d1d72497a /lib/Sema/SemaExpr.cpp | |
parent | 54abf7d4fa3123b8324c09d2a4dfb789fd818403 (diff) |
Diagnose __builtin_offsetof on incomplete types. Fixes
rdar://problem/7222956
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85999 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index f1014c6dfe..2c54a792c1 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -5707,6 +5707,10 @@ Sema::OwningExprResult Sema::ActOnBuiltinOffsetOf(Scope *S, if (!Dependent) { bool DidWarnAboutNonPOD = false; + if (RequireCompleteType(TypeLoc, Res->getType(), + diag::err_offsetof_incomplete_type)) + return ExprError(); + // FIXME: Dependent case loses a lot of information here. And probably // leaks like a sieve. for (unsigned i = 0; i != NumComponents; ++i) { |