diff options
Diffstat (limited to 'libphobos/src/std')
-rw-r--r-- | libphobos/src/std/mmfile.d | 10 | ||||
-rw-r--r-- | libphobos/src/std/sumtype.d | 22 |
2 files changed, 12 insertions, 20 deletions
diff --git a/libphobos/src/std/mmfile.d b/libphobos/src/std/mmfile.d index e4000d4..f8f8a90 100644 --- a/libphobos/src/std/mmfile.d +++ b/libphobos/src/std/mmfile.d @@ -71,13 +71,13 @@ class MmFile * - On POSIX, $(REF ErrnoException, std, exception). * - On Windows, $(REF WindowsException, std, windows, syserror). */ - this(string filename) + this(string filename) scope { this(filename, Mode.read, 0, null); } version (linux) this(File file, Mode mode = Mode.read, ulong size = 0, - void* address = null, size_t window = 0) + void* address = null, size_t window = 0) scope { // Save a copy of the File to make sure the fd stays open. this.file = file; @@ -85,7 +85,7 @@ class MmFile } version (linux) private this(int fildes, Mode mode, ulong size, - void* address, size_t window) + void* address, size_t window) scope { int oflag; int fmode; @@ -169,7 +169,7 @@ class MmFile * - On Windows, $(REF WindowsException, std, windows, syserror). */ this(string filename, Mode mode, ulong size, void* address, - size_t window = 0) + size_t window = 0) scope { this.filename = filename; this.mMode = mode; @@ -364,7 +364,7 @@ class MmFile /** * Flushes pending output and closes the memory mapped file. */ - ~this() + ~this() scope { debug (MMFILE) printf("MmFile.~this()\n"); unmap(); diff --git a/libphobos/src/std/sumtype.d b/libphobos/src/std/sumtype.d index 869c36f..f3d3152 100644 --- a/libphobos/src/std/sumtype.d +++ b/libphobos/src/std/sumtype.d @@ -1313,6 +1313,7 @@ version (D_BetterC) {} else // Types with invariants // Disabled in BetterC due to use of exceptions version (D_BetterC) {} else +version (D_Invariants) @system unittest { import std.exception : assertThrown; @@ -1330,22 +1331,13 @@ version (D_BetterC) {} else invariant { assert(i >= 0); } } - // Only run test if contract checking is enabled - try - { - S probe = S(-1); - assert(&probe); - } - catch (AssertError _) - { - SumType!S x; - x.match!((ref v) { v.i = -1; }); - assertThrown!AssertError(assert(&x)); + SumType!S x; + x.match!((ref v) { v.i = -1; }); + assertThrown!AssertError(assert(&x)); - SumType!C y = new C(); - y.match!((ref v) { v.i = -1; }); - assertThrown!AssertError(assert(&y)); - } + SumType!C y = new C(); + y.match!((ref v) { v.i = -1; }); + assertThrown!AssertError(assert(&y)); } // Calls value postblit on self-assignment |