Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c42dbb9
commit a6b73d2
Showing
8 changed files
with
106 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// PERMUTE_ARGS: | ||
|
||
struct Field | ||
{ | ||
this(this) @safe @nogc pure nothrow {} | ||
} | ||
|
||
struct Counter | ||
{ | ||
static size_t cnt; | ||
this(this) @safe @nogc nothrow { ++cnt; } | ||
} | ||
|
||
struct Foo | ||
{ | ||
this(this) @safe @nogc pure nothrow {} | ||
Field field; | ||
} | ||
|
||
void test1() @safe @nogc pure nothrow | ||
{ | ||
Foo foo; | ||
foo.__xpostblit(); | ||
} | ||
|
||
static assert(__traits(hasMember, Foo, "__xpostblit")); | ||
|
||
// | ||
|
||
struct FieldPostblit | ||
{ | ||
Counter counter; | ||
} | ||
|
||
struct AggrPostblit | ||
{ | ||
static size_t cnt; | ||
this(this) @safe @nogc nothrow { ++cnt; } | ||
} | ||
|
||
struct MixedPostblit | ||
{ | ||
static size_t cnt; | ||
Counter counter; | ||
this(this) @safe @nogc nothrow { ++cnt; } | ||
} | ||
|
||
struct SNoPostblit {} | ||
class CNoPostblit {} | ||
|
||
static assert(!__traits(hasMember, SNoPostblit, "__xpostblit")); | ||
static assert(!__traits(hasMember, CNoPostblit, "__xpostblit")); | ||
|
||
void test2() @safe @nogc nothrow | ||
{ | ||
FieldPostblit a; | ||
assert(Counter.cnt == 0); | ||
a.__xpostblit(); | ||
assert(Counter.cnt == 1); | ||
AggrPostblit b; | ||
assert(AggrPostblit.cnt == 0); | ||
b.__xpostblit(); | ||
assert(AggrPostblit.cnt == 1); | ||
Counter.cnt = 0; | ||
MixedPostblit c; | ||
assert(MixedPostblit.cnt == 0); | ||
assert(Counter.cnt == 0); | ||
c.__xpostblit(); | ||
assert(MixedPostblit.cnt == 1); | ||
assert(Counter.cnt == 1); | ||
} | ||
|
||
void main() | ||
{ | ||
test1(); | ||
test2(); | ||
} |