Skip to content

Commit

Permalink
Remove special handling of old .offset property
Browse files Browse the repository at this point in the history
  • Loading branch information
yebblies committed Aug 28, 2014
1 parent 725c097 commit 35b0083
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 1 addition & 7 deletions src/mtype.c
Expand Up @@ -2262,14 +2262,8 @@ Expression *Type::dotExp(Scope *sc, Expression *e, Identifier *ident, int flag)
}
if (v)
{
if (ident == Id::offset)
if (ident == Id::offsetof)
{
error(e->loc, ".offset deprecated, use .offsetof");
goto Loffset;
}
else if (ident == Id::offsetof)
{
Loffset:
if (v->isField())
{
e = new IntegerExp(e->loc, v->offset, Type::tsize_t);
Expand Down
12 changes: 12 additions & 0 deletions test/fail_compilation/failoffset.d
@@ -0,0 +1,12 @@
/*
TEST_OUTPUT:
---
fail_compilation/failoffset.d(11): Error: no property 'offset' for type 'int'
---
*/

void main()
{
struct S { int a, b; }
static assert(S.b.offset == 4);
}

0 comments on commit 35b0083

Please sign in to comment.