diff --git a/std/array.d b/std/array.d index 1da743abc..bacae49ab 100644 --- a/std/array.d +++ b/std/array.d @@ -2985,9 +2985,9 @@ unittest //static assert(!is(typeof(Appender!string(cc)))); //This should always work: - appender!string(null); - appender!(const(char)[])(null); - appender!(char[])(null); + {auto app = appender!string(null);} + {auto app = appender!(const(char)[])(null);} + {auto app = appender!(char[])(null);} } unittest //Test large allocations (for GC.extend) diff --git a/std/range.d b/std/range.d index 2a9a6882c..6bda76419 100644 --- a/std/range.d +++ b/std/range.d @@ -2052,7 +2052,7 @@ unittest test([ 1, 2, 3, 4, 5, 6 ], [ 6, 5, 4, 3, 2, 1 ]); immutable foo = [1,2,3].idup; - retro(foo); + auto r = retro(foo); } unittest @@ -9210,12 +9210,7 @@ assert(buffer2 == [11, 12, 13, 14, 15]); } else { - private static void _testSave(R)(R* range) - { - (*range).save; - } - - static if(isSafe!(_testSave!R)) + static if(isSafe!((R* r) => (*r).save)) { @property auto save() @trusted { diff --git a/std/utf.d b/std/utf.d index 95f1f39c7..a78634f34 100644 --- a/std/utf.d +++ b/std/utf.d @@ -507,10 +507,10 @@ uint stride(S)(auto ref S str) foreach (S; TypeTuple!(wchar[], const wchar[], wstring)) { enum str = to!S("hello world"); - static assert(isSafe!({ stride(str, 0); })); - static assert(isSafe!({ stride(str); })); - static assert((functionAttributes!({ stride(str, 0); }) & FunctionAttribute.pure_) != 0); - static assert((functionAttributes!({ stride(str); }) & FunctionAttribute.pure_) != 0); + static assert(isSafe!(() => stride(str, 0))); + static assert(isSafe!(() => stride(str) )); + static assert((functionAttributes!(() => stride(str, 0)) & FunctionAttribute.pure_) != 0); + static assert((functionAttributes!(() => stride(str) ) & FunctionAttribute.pure_) != 0); } }); } @@ -623,10 +623,10 @@ unittest foreach (S; TypeTuple!(wchar[], const wchar[], wstring)) { enum str = to!S("hello world"); - static assert(isSafe!({ strideBack(str, 0); })); - static assert(isSafe!({ strideBack(str); })); - static assert((functionAttributes!({ strideBack(str, 0); }) & FunctionAttribute.pure_) != 0); - static assert((functionAttributes!({ strideBack(str); }) & FunctionAttribute.pure_) != 0); + static assert(isSafe!(() => strideBack(str, 0))); + static assert(isSafe!(() => strideBack(str) )); + static assert((functionAttributes!(() => strideBack(str, 0)) & FunctionAttribute.pure_) != 0); + static assert((functionAttributes!(() => strideBack(str) ) & FunctionAttribute.pure_) != 0); } }); } @@ -710,10 +710,10 @@ unittest foreach (S; TypeTuple!(dchar[], const dchar[], dstring)) { enum str = to!S("hello world"); - static assert(isSafe!({ stride(str, 0); })); - static assert(isSafe!({ stride(str); })); - static assert((functionAttributes!({ stride(str, 0); }) & FunctionAttribute.pure_) != 0); - static assert((functionAttributes!({ stride(str); }) & FunctionAttribute.pure_) != 0); + static assert(isSafe!(() => stride(str, 0))); + static assert(isSafe!(() => stride(str) )); + static assert((functionAttributes!(() => stride(str, 0)) & FunctionAttribute.pure_) != 0); + static assert((functionAttributes!(() => stride(str) ) & FunctionAttribute.pure_) != 0); } }); } @@ -807,10 +807,10 @@ unittest foreach (S; TypeTuple!(dchar[], const dchar[], dstring)) { enum str = to!S("hello world"); - static assert(isSafe!({ strideBack(str, 0); })); - static assert(isSafe!({ strideBack(str); })); - static assert((functionAttributes!({ strideBack(str, 0); }) & FunctionAttribute.pure_) != 0); - static assert((functionAttributes!({ strideBack(str); }) & FunctionAttribute.pure_) != 0); + static assert(isSafe!(() => strideBack(str, 0))); + static assert(isSafe!(() => strideBack(str) )); + static assert((functionAttributes!(() => strideBack(str, 0)) & FunctionAttribute.pure_) != 0); + static assert((functionAttributes!(() => strideBack(str) ) & FunctionAttribute.pure_) != 0); } }); } diff --git a/unittest.d b/unittest.d index 9d64a8f64..21deea05e 100644 --- a/unittest.d +++ b/unittest.d @@ -64,7 +64,7 @@ int main(char[][] args) { // Bring in unit test for module by referencing function in it - cmp("foo", "bar"); // string + cast(void)cmp("foo", "bar"); // string cast(void)filenameCharCmp('a', 'b'); // path cast(void)isNaN(1.0); // math std.conv.to!double("1.0"); // std.conv