diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-06-14 18:27:59 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-06-14 18:27:59 -0400 |
| commit | 32dd98b19fe3cc384df32704dac0ff3e377dbe0c (patch) | |
| tree | 2eddf3618d80313bdd24c25bd589bd474f3d82fc /test/cases/struct.zig | |
| parent | ef7f69d14a017c6c2065e4a376bb8e1f05ace04b (diff) | |
| parent | f0697c28f80d64c544302aea576e41ebc443b41c (diff) | |
| download | zig-32dd98b19fe3cc384df32704dac0ff3e377dbe0c.tar.gz zig-32dd98b19fe3cc384df32704dac0ff3e377dbe0c.zip | |
Merge remote-tracking branch 'origin/master' into llvm7
Diffstat (limited to 'test/cases/struct.zig')
| -rw-r--r-- | test/cases/struct.zig | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/cases/struct.zig b/test/cases/struct.zig index 6f7d44e09b..6952611a8c 100644 --- a/test/cases/struct.zig +++ b/test/cases/struct.zig @@ -421,3 +421,20 @@ const Expr = union(enum) { fn alloc(comptime T: type) []T { return []T{}; } + +test "call method with mutable reference to struct with no fields" { + const S = struct { + fn doC(s: *const this) bool { + return true; + } + fn do(s: *this) bool { + return true; + } + }; + + var s = S{}; + assert(S.doC(&s)); + assert(s.doC()); + assert(S.do(&s)); + assert(s.do()); +} |
