aboutsummaryrefslogtreecommitdiffstats
path: root/cparser
diff options
context:
space:
mode:
Diffstat (limited to 'cparser')
-rw-r--r--cparser/Elab.ml7
1 files changed, 4 insertions, 3 deletions
diff --git a/cparser/Elab.ml b/cparser/Elab.ml
index d8d1d7d2..afdf3969 100644
--- a/cparser/Elab.ml
+++ b/cparser/Elab.ml
@@ -1644,11 +1644,12 @@ let elab_expr vararg loc env a =
| BUILTIN_OFFSETOF ((spec,dcl), mem) ->
let (ty,env) = elab_type loc env spec dcl in
+ if Cutil.incomplete_type env ty then
+ error "offsetof of incomplete type %a" (print_typ env) ty;
let offset =
match unroll env ty with
- | TStruct(id, attrs) ->
- if Cutil.incomplete_type env ty then
- error "offsetof of incomplete type %a" (print_typ env) ty;
+ | TStruct(id,_)
+ | TUnion (id,_)->
let fld = (wrap Env.find_struct_member loc env (id,mem)) in
if List.exists (fun fld -> fld.fld_bitfield <> None) fld then
error "cannot compute the offset of bitfield '%s" mem;