[Issue 12024] [REG DMD2.065-b2] template instantiation for swap(SysTime, SysTime) fails

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 29 06:05:50 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12024



--- Comment #10 from Vladimir Panteleev <thecybershadow at gmail.com> 2014-01-29 16:05:44 EET ---
Interesting. So this should "just work":

diff --git a/std/algorithm.d b/std/algorithm.d
index 036b918..0ed5606 100644
--- a/std/algorithm.d
+++ b/std/algorithm.d
@@ -2054,6 +2054,9 @@ void swap(T)(ref T lhs, ref T rhs) if
(is(typeof(lhs.proxySwap(rhs))))
 private template allMutableFields(T)
 {
     alias OT = OriginalType!T;
+    static if (is(typeof({ T t = void; t = t; })))
+        enum allMutableFields = true;
+    else
     static if (is(OT == struct) || is(OT == union))
         enum allMutableFields = isMutable!OT && allSatisfy!(.allMutableFields,
FieldTypeTuple!OT);
     else
@@ -2072,6 +2075,9 @@ unittest
     struct S2{const int i;}
     static assert( allMutableFields!S1);
     static assert(!allMutableFields!S2);
+
+    struct S3{union X{int m;const int c;}X x;}
+    static assert( allMutableFields!S3);
 }

 unittest

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list