@@ -182,15 +182,15 @@ U[] _dup(T, U)(T[] a) if (!__traits(isPOD, T))
182182 cast (void ) [].dup ! Sunsafe;
183183 static assert (! __traits(compiles, () pure { [].dup ! Sunpure; }));
184184 static assert (! __traits(compiles, () nothrow { [].dup ! Sthrow; }));
185- static assert (! __traits(compiles, () @safe { [] .dup ! Sunsafe ; }));
185+ static assert (! __traits(compiles, () @safe { Sunsafe[ 1 ] a; a[] .dup ; }));
186186 static assert (! __traits(compiles, () { [].dup ! Snocopy; }));
187187
188188 [].idup! Sunpure;
189189 [].idup! Sthrow;
190190 [].idup! Sunsafe;
191- static assert (! __traits(compiles, () pure { [] .idup! Sunpure ; }));
192- static assert (! __traits(compiles, () nothrow { [] .idup! Sthrow ; }));
193- static assert (! __traits(compiles, () @safe { [] .idup! Sunsafe ; }));
191+ static assert (! __traits(compiles, () pure { Sunpure[ 1 ] a; a[] .idup; }));
192+ static assert (! __traits(compiles, () nothrow { Sthrow[ 1 ] a; a[] .idup; }));
193+ static assert (! __traits(compiles, () @safe { Sunsafe[ 1 ] a; a[] .idup; }));
194194 static assert (! __traits(compiles, () { [].idup! Snocopy; }));
195195}
196196
@@ -225,27 +225,21 @@ U[] _dup(T, U)(T[] a) if (!__traits(isPOD, T))
225225
226226@system unittest
227227{
228- static struct Sunpure { this (ref const typeof ( this ) ) @safe nothrow {} }
229- static struct Sthrow { this (ref const typeof ( this ) ) @safe pure {} }
230- static struct Sunsafe { this (ref const typeof ( this ) ) @system pure nothrow {} }
228+ static struct Sunpure { this (ref const Sunpure ) @safe nothrow {} }
229+ static struct Sthrow { this (ref const Sthrow ) @safe pure {} }
230+ static struct Sunsafe { this (ref const Sunsafe ) @system pure nothrow {} }
231231 [].dup ! Sunpure;
232232 [].dup ! Sthrow;
233233 cast (void ) [].dup ! Sunsafe;
234- static assert (! __traits(compiles, () pure { [].dup ! Sunpure; }));
235- static assert (! __traits(compiles, () nothrow { [].dup ! Sthrow; }));
236- static assert (! __traits(compiles, () @safe { [].dup ! Sunsafe; }));
237234
238235 // for idup to work on structs that have copy constructors, it is necessary
239236 // that the struct defines a copy constructor that creates immutable objects
240- static struct ISunpure { this (ref const typeof ( this ) ) immutable @safe nothrow {} }
241- static struct ISthrow { this (ref const typeof ( this ) ) immutable @safe pure {} }
242- static struct ISunsafe { this (ref const typeof ( this ) ) immutable @system pure nothrow {} }
237+ static struct ISunpure { this (ref const ISunpure ) immutable @safe nothrow {} }
238+ static struct ISthrow { this (ref const ISthrow ) immutable @safe pure {} }
239+ static struct ISunsafe { this (ref const ISunsafe ) immutable @system pure nothrow {} }
243240 [].idup! ISunpure;
244241 [].idup! ISthrow;
245242 [].idup! ISunsafe;
246- static assert (! __traits(compiles, () pure { [].idup! ISunpure; }));
247- static assert (! __traits(compiles, () nothrow { [].idup! ISthrow; }));
248- static assert (! __traits(compiles, () @safe { [].idup! ISunsafe; }));
249243}
250244
251245@safe unittest
@@ -374,7 +368,6 @@ U[] _dup(T, U)(T[] a) if (!__traits(isPOD, T))
374368 static assert (test! Postblit());
375369 assert (test! Postblit());
376370
377- static assert (test! Copy());
378371 assert (test! Copy());
379372}
380373
0 commit comments