summaryrefslogtreecommitdiffstats
path: root/libphobos
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2022-03-02 18:16:08 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2022-03-02 18:21:38 +0100
commit8977f4bec650bb6975792772245b07b722ee9843 (patch)
tree495444470878e267304174ed409829358ae07740 /libphobos
parentUndo multi-word optional reloads correctly (diff)
downloadgcc-8977f4bec650bb6975792772245b07b722ee9843.tar.gz
gcc-8977f4bec650bb6975792772245b07b722ee9843.tar.bz2
gcc-8977f4bec650bb6975792772245b07b722ee9843.tar.xz
d: Merge upstream dmd 423f19b41, druntime 100a608c, phobos a1f8c4c07.
D Runtime changes: - Fix stdc.stdio bindings to not depend on druntime (PR104729). - Implement stdc.math for Solaris (PR104735). gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 423f19b41. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 100a608c. * src/MERGE: Merge upstream phobos a1f8c4c07.
Diffstat (limited to 'libphobos')
-rw-r--r--libphobos/libdruntime/MERGE2
-rw-r--r--libphobos/libdruntime/core/memory.d9
-rw-r--r--libphobos/libdruntime/core/stdc/math.d133
-rw-r--r--libphobos/libdruntime/core/stdc/stdio.d16
-rw-r--r--libphobos/libdruntime/core/stdcpp/exception.d10
-rw-r--r--libphobos/libdruntime/core/stdcpp/typeinfo.d40
-rw-r--r--libphobos/libdruntime/core/sys/posix/locale.d2
-rw-r--r--libphobos/libdruntime/object.d18
-rw-r--r--libphobos/src/MERGE2
-rw-r--r--libphobos/src/std/datetime/systime.d35
-rw-r--r--libphobos/src/std/sumtype.d41
11 files changed, 210 insertions, 98 deletions
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index 7c0bb573e2b..c4b1538b3a4 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@
1caf14b0f4ebbae4157aac89368d6278332ee2aa1 10316b981e5f2fa1525e893c5d94c59c847a8c386
2 2
3The first line of this file holds the git revision number of the last 3The first line of this file holds the git revision number of the last
4merge done from the dlang/druntime repository. 4merge done from the dlang/druntime repository.
diff --git a/libphobos/libdruntime/core/memory.d b/libphobos/libdruntime/core/memory.d
index f25ba6f1d46..27c84e7f55e 100644
--- a/libphobos/libdruntime/core/memory.d
+++ b/libphobos/libdruntime/core/memory.d
@@ -1229,7 +1229,10 @@ void __delete(T)(ref T x) @system
1229 else static if (is(T == U*, U)) 1229 else static if (is(T == U*, U))
1230 { 1230 {
1231 static if (is(U == struct)) 1231 static if (is(U == struct))
1232 _destructRecurse(*x); 1232 {
1233 if (x)
1234 _destructRecurse(*x);
1235 }
1233 } 1236 }
1234 else static if (is(T : E[], E)) 1237 else static if (is(T : E[], E))
1235 { 1238 {
@@ -1334,6 +1337,10 @@ unittest
1334 assert(a is null); 1337 assert(a is null);
1335 assert(dtorCalled); 1338 assert(dtorCalled);
1336 assert(GC.addrOf(cast(void*) a) == null); 1339 assert(GC.addrOf(cast(void*) a) == null);
1340
1341 // https://issues.dlang.org/show_bug.cgi?id=22779
1342 A *aptr;
1343 __delete(aptr);
1337} 1344}
1338 1345
1339/// Deleting arrays 1346/// Deleting arrays
diff --git a/libphobos/libdruntime/core/stdc/math.d b/libphobos/libdruntime/core/stdc/math.d
index 0c5da0bfefa..0393ea52c07 100644
--- a/libphobos/libdruntime/core/stdc/math.d
+++ b/libphobos/libdruntime/core/stdc/math.d
@@ -90,6 +90,13 @@ else version (DragonFlyBSD)
90 /// 90 ///
91 enum int FP_ILOGBNAN = int.max; 91 enum int FP_ILOGBNAN = int.max;
92} 92}
93else version (Solaris)
94{
95 ///
96 enum int FP_ILOGB0 = -int.max;
97 ///
98 enum int FP_ILOGBNAN = int.max;
99}
93else version (CRuntime_Bionic) 100else version (CRuntime_Bionic)
94{ 101{
95 /// 102 ///
@@ -1380,18 +1387,128 @@ else version (DragonFlyBSD)
1380} 1387}
1381else version (Solaris) 1388else version (Solaris)
1382{ 1389{
1383 pure int __isnanf(float x); 1390 enum
1384 pure int __isnan(double x); 1391 {
1385 pure int __isnanl(real x); 1392 FP_INFINITE = 3,
1393 FP_NAN = 4,
1394 FP_NORMAL = 2,
1395 FP_SUBNORMAL = 1,
1396 FP_ZERO = 0,
1397 }
1398
1399 enum
1400 {
1401 ///
1402 FP_FAST_FMA = 0,
1403 ///
1404 FP_FAST_FMAF = 0,
1405 ///
1406 FP_FAST_FMAL = 0,
1407 }
1408
1409 extern (D)
1410 {
1411 //int fpclassify(real-floating x);
1412 ///
1413 pure int fpclassify(float x)
1414 {
1415 return isnan(x) ? FP_NAN : isinf(x) ? FP_INFINITE :
1416 isnormal(x) ? FP_NORMAL : x == 0.0f ? FP_ZERO :
1417 FP_SUBNORMAL;
1418 }
1419
1420 ///
1421 pure int fpclassify(double x)
1422 {
1423 return isnan(x) ? FP_NAN : isinf(x) ? FP_INFINITE :
1424 isnormal(x) ? FP_NORMAL : x == 0.0 ? FP_ZERO :
1425 FP_SUBNORMAL;
1426 }
1427
1428 ///
1429 pure int fpclassify(real x)
1430 {
1431 return isnan(x) ? FP_NAN : isinf(x) ? FP_INFINITE :
1432 isnormal(x) ? FP_NORMAL : x == 0.0L ? FP_ZERO :
1433 FP_SUBNORMAL;
1434 }
1435
1436 //int isfinite(real-floating x);
1437 ///
1438 pure int isfinite(float x) { return !isnan(x) && !isinf(x); }
1439 ///
1440 pure int isfinite(double x) { return !isnan(x) && !isinf(x); }
1441 ///
1442 pure int isfinite(real x) { return !isnan(x) && !isinf(x); }
1443
1444 //int isinf(real-floating x);
1445 ///
1446 pure int isinf(float x) { return x == float.infinity || x == -float.infinity; }
1447 ///
1448 pure int isinf(double x) { return x == double.infinity || x == -double.infinity; }
1449 ///
1450 pure int isinf(real x) { return x == real.infinity || x == -real.infinity; }
1386 1451
1387 //int isnan(real-floating x); 1452 //int isnan(real-floating x);
1388 ///
1389 pragma(mangle, "__isnanf") pure int isnan(float x);
1390 /// 1453 ///
1391 pragma(mangle, "__isnan") pure int isnan(double x); 1454 pure int isnan(float x) { return x != x; }
1392 /// 1455 ///
1393 pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl") 1456 pure int isnan(double x) { return x != x; }
1394 pure int isnan(real x); 1457 ///
1458 pure int isnan(real x) { return x != x; }
1459
1460 //int isnormal(real-floating x);
1461 ///
1462 pure int isnormal(float x)
1463 {
1464 import core.math;
1465 return isfinite(x) && fabs(x) >= float.min_normal;
1466 }
1467 ///
1468 pure int isnormal(double x)
1469 {
1470 import core.math;
1471 return isfinite(x) && fabs(x) >= double.min_normal;
1472 }
1473 ///
1474 pure int isnormal(real x)
1475 {
1476 import core.math;
1477 return isfinite(x) && fabs(x) >= real.min_normal;
1478 }
1479
1480 //int signbit(real-floating x);
1481 ///
1482 pure int signbit(float x)
1483 {
1484 version (SPARC_Any)
1485 return cast(int)(*cast(uint*)&x >> 31);
1486 else version (X86_Any)
1487 return cast(int)(*cast(uint*)&x >> 31);
1488 else
1489 static assert(false, "Architecture not supported.");
1490 }
1491 ///
1492 pure int signbit(double x)
1493 {
1494 version (SPARC_Any)
1495 return cast(int)(*cast(uint*)&x >> 31);
1496 else version (X86_Any)
1497 return cast(int)((cast(uint*)&x)[1] >> 31);
1498 else
1499 static assert(false, "Architecture not supported.");
1500 }
1501 ///
1502 pure int signbit(real x)
1503 {
1504 version (SPARC_Any)
1505 return cast(int)(*cast(uint*)&x >> 31);
1506 else version (X86_Any)
1507 return cast(int)((cast(ushort *)&x)[4] >> 15);
1508 else
1509 static assert(false, "Architecture not supported.");
1510 }
1511 }
1395} 1512}
1396else version (CRuntime_Bionic) 1513else version (CRuntime_Bionic)
1397{ 1514{
diff --git a/libphobos/libdruntime/core/stdc/stdio.d b/libphobos/libdruntime/core/stdc/stdio.d
index 0dcdb6efc26..cd53f0ab50b 100644
--- a/libphobos/libdruntime/core/stdc/stdio.d
+++ b/libphobos/libdruntime/core/stdc/stdio.d
@@ -983,7 +983,7 @@ else version (NetBSD)
983 _IONBF = 2, 983 _IONBF = 2,
984 } 984 }
985 985
986 private extern __gshared FILE[3] __sF; 986 private extern shared FILE[3] __sF;
987 @property auto __stdin()() { return &__sF[0]; } 987 @property auto __stdin()() { return &__sF[0]; }
988 @property auto __stdout()() { return &__sF[1]; } 988 @property auto __stdout()() { return &__sF[1]; }
989 @property auto __stderr()() { return &__sF[2]; } 989 @property auto __stderr()() { return &__sF[2]; }
@@ -1006,7 +1006,7 @@ else version (OpenBSD)
1006 _IONBF = 2, 1006 _IONBF = 2,
1007 } 1007 }
1008 1008
1009 private extern __gshared FILE[3] __sF; 1009 private extern shared FILE[3] __sF;
1010 @property auto __stdin()() { return &__sF[0]; } 1010 @property auto __stdin()() { return &__sF[0]; }
1011 @property auto __stdout()() { return &__sF[1]; } 1011 @property auto __stdout()() { return &__sF[1]; }
1012 @property auto __stderr()() { return &__sF[2]; } 1012 @property auto __stderr()() { return &__sF[2]; }
@@ -1061,11 +1061,11 @@ else version (Solaris)
1061 private extern shared FILE[_NFILE] __iob; 1061 private extern shared FILE[_NFILE] __iob;
1062 1062
1063 /// 1063 ///
1064 shared stdin = &__iob[0]; 1064 @property auto stdin()() { return &__iob[0]; }
1065 /// 1065 ///
1066 shared stdout = &__iob[1]; 1066 @property auto stdout()() { return &__iob[1]; }
1067 /// 1067 ///
1068 shared stderr = &__iob[2]; 1068 @property auto stderr()() { return &__iob[2]; }
1069} 1069}
1070else version (CRuntime_Bionic) 1070else version (CRuntime_Bionic)
1071{ 1071{
@@ -1082,11 +1082,11 @@ else version (CRuntime_Bionic)
1082 private extern shared FILE[3] __sF; 1082 private extern shared FILE[3] __sF;
1083 1083
1084 /// 1084 ///
1085 shared stdin = &__sF[0]; 1085 @property auto stdin()() { return &__sF[0]; }
1086 /// 1086 ///
1087 shared stdout = &__sF[1]; 1087 @property auto stdout()() { return &__sF[1]; }
1088 /// 1088 ///
1089 shared stderr = &__sF[2]; 1089 @property auto stderr()() { return &__sF[2]; }
1090} 1090}
1091else version (CRuntime_Musl) 1091else version (CRuntime_Musl)
1092{ 1092{
diff --git a/libphobos/libdruntime/core/stdcpp/exception.d b/libphobos/libdruntime/core/stdcpp/exception.d
index d65cd8d1832..d5339964e36 100644
--- a/libphobos/libdruntime/core/stdcpp/exception.d
+++ b/libphobos/libdruntime/core/stdcpp/exception.d
@@ -69,7 +69,7 @@ version (GenericBaseException)
69 { 69 {
70 @nogc: 70 @nogc:
71 /// 71 ///
72 this() nothrow {} 72 extern(D) this() nothrow {}
73 /// 73 ///
74 @weak ~this() nothrow {} // HACK: this should extern, but then we have link errors! 74 @weak ~this() nothrow {} // HACK: this should extern, but then we have link errors!
75 75
@@ -77,7 +77,7 @@ version (GenericBaseException)
77 @weak const(char)* what() const nothrow { return "unknown"; } // HACK: this should extern, but then we have link errors! 77 @weak const(char)* what() const nothrow { return "unknown"; } // HACK: this should extern, but then we have link errors!
78 78
79 protected: 79 protected:
80 this(const(char)*, int = 1) nothrow { this(); } // compat with MS derived classes 80 extern(D) this(const(char)*, int = 1) nothrow { this(); } // compat with MS derived classes
81 } 81 }
82} 82}
83else version (CppRuntime_DigitalMars) 83else version (CppRuntime_DigitalMars)
@@ -87,7 +87,7 @@ else version (CppRuntime_DigitalMars)
87 { 87 {
88 @nogc: 88 @nogc:
89 /// 89 ///
90 this() nothrow {} 90 extern(D) this() nothrow {}
91 //virtual ~this(); 91 //virtual ~this();
92 void dtor() { } // reserve slot in vtbl[] 92 void dtor() { } // reserve slot in vtbl[]
93 93
@@ -105,7 +105,7 @@ else version (CppRuntime_Microsoft)
105 { 105 {
106 @nogc: 106 @nogc:
107 /// 107 ///
108 this(const(char)* message = "unknown", int = 1) nothrow { msg = message; } 108 extern(D) this(const(char)* message = "unknown", int = 1) nothrow { msg = message; }
109 /// 109 ///
110 @weak ~this() nothrow {} 110 @weak ~this() nothrow {}
111 111
@@ -131,7 +131,7 @@ class bad_exception : exception
131{ 131{
132@nogc: 132@nogc:
133 /// 133 ///
134 this(const(char)* message = "bad exception") { super(message); } 134 extern(D) this(const(char)* message = "bad exception") nothrow { super(message); }
135 135
136 version (GenericBaseException) 136 version (GenericBaseException)
137 { 137 {
diff --git a/libphobos/libdruntime/core/stdcpp/typeinfo.d b/libphobos/libdruntime/core/stdcpp/typeinfo.d
index 53b25c5e9a5..24f2938ccab 100644
--- a/libphobos/libdruntime/core/stdcpp/typeinfo.d
+++ b/libphobos/libdruntime/core/stdcpp/typeinfo.d
@@ -18,10 +18,10 @@ version (CppRuntime_DigitalMars)
18 import core.stdcpp.exception; 18 import core.stdcpp.exception;
19 19
20 extern (C++, "std"): 20 extern (C++, "std"):
21 @nogc:
22 21
23 class type_info 22 class type_info
24 { 23 {
24 @nogc:
25 void* pdata; 25 void* pdata;
26 26
27 public: 27 public:
@@ -41,8 +41,9 @@ version (CppRuntime_DigitalMars)
41 41
42 class bad_cast : exception 42 class bad_cast : exception
43 { 43 {
44 this() nothrow { } 44 @nogc:
45 this(const bad_cast) nothrow { } 45 extern(D) this() nothrow { }
46 extern(D) this(const bad_cast) nothrow { }
46 //bad_cast operator=(const bad_cast) nothrow { return this; } 47 //bad_cast operator=(const bad_cast) nothrow { return this; }
47 //virtual ~this() nothrow; 48 //virtual ~this() nothrow;
48 override const(char)* what() const nothrow; 49 override const(char)* what() const nothrow;
@@ -50,8 +51,9 @@ version (CppRuntime_DigitalMars)
50 51
51 class bad_typeid : exception 52 class bad_typeid : exception
52 { 53 {
53 this() nothrow { } 54 @nogc:
54 this(const bad_typeid) nothrow { } 55 extern(D) this() nothrow { }
56 extern(D) this(const bad_typeid) nothrow { }
55 //bad_typeid operator=(const bad_typeid) nothrow { return this; } 57 //bad_typeid operator=(const bad_typeid) nothrow { return this; }
56 //virtual ~this() nothrow; 58 //virtual ~this() nothrow;
57 override const (char)* what() const nothrow; 59 override const (char)* what() const nothrow;
@@ -62,7 +64,6 @@ else version (CppRuntime_Microsoft)
62 import core.stdcpp.exception; 64 import core.stdcpp.exception;
63 65
64 extern (C++, "std"): 66 extern (C++, "std"):
65 @nogc:
66 67
67 struct __type_info_node 68 struct __type_info_node
68 { 69 {
@@ -74,6 +75,7 @@ else version (CppRuntime_Microsoft)
74 75
75 class type_info 76 class type_info
76 { 77 {
78 @nogc:
77 @weak ~this() nothrow {} 79 @weak ~this() nothrow {}
78 //bool operator==(const type_info rhs) const; 80 //bool operator==(const type_info rhs) const;
79 //bool operator!=(const type_info rhs) const; 81 //bool operator!=(const type_info rhs) const;
@@ -88,13 +90,15 @@ else version (CppRuntime_Microsoft)
88 90
89 class bad_cast : exception 91 class bad_cast : exception
90 { 92 {
91 this(const(char)* msg = "bad cast") @nogc nothrow { super(msg); } 93 @nogc:
94 extern(D) this(const(char)* msg = "bad cast") nothrow { super(msg); }
92 //virtual ~this(); 95 //virtual ~this();
93 } 96 }
94 97
95 class bad_typeid : exception 98 class bad_typeid : exception
96 { 99 {
97 this(const(char)* msg = "bad typeid") @nogc nothrow { super(msg); } 100 @nogc:
101 extern(D) this(const(char)* msg = "bad typeid") nothrow { super(msg); }
98 //virtual ~this(); 102 //virtual ~this();
99 } 103 }
100} 104}
@@ -108,10 +112,10 @@ else version (CppRuntime_Gcc)
108 } 112 }
109 113
110 extern (C++, "std"): 114 extern (C++, "std"):
111 @nogc:
112 115
113 abstract class type_info 116 abstract class type_info
114 { 117 {
118 @nogc:
115 @weak ~this() {} 119 @weak ~this() {}
116 @weak final const(char)* name() const nothrow 120 @weak final const(char)* name() const nothrow
117 { 121 {
@@ -133,19 +137,21 @@ else version (CppRuntime_Gcc)
133 protected: 137 protected:
134 const(char)* _name; 138 const(char)* _name;
135 139
136 this(const(char)* name) { _name = name; } 140 extern(D) this(const(char)* name) { _name = name; }
137 } 141 }
138 142
139 class bad_cast : exception 143 class bad_cast : exception
140 { 144 {
141 this() nothrow {} 145 @nogc:
146 extern(D) this() nothrow {}
142 //~this(); 147 //~this();
143 @weak override const(char)* what() const nothrow { return "bad cast"; } 148 @weak override const(char)* what() const nothrow { return "bad cast"; }
144 } 149 }
145 150
146 class bad_typeid : exception 151 class bad_typeid : exception
147 { 152 {
148 this() nothrow {} 153 @nogc:
154 extern(D) this() nothrow {}
149 //~this(); 155 //~this();
150 @weak override const(char)* what() const nothrow { return "bad typeid"; } 156 @weak override const(char)* what() const nothrow { return "bad typeid"; }
151 } 157 }
@@ -155,10 +161,10 @@ else version (CppRuntime_Clang)
155 import core.stdcpp.exception; 161 import core.stdcpp.exception;
156 162
157 extern (C++, "std"): 163 extern (C++, "std"):
158 @nogc:
159 164
160 abstract class type_info 165 abstract class type_info
161 { 166 {
167 @nogc:
162 @weak ~this() {} 168 @weak ~this() {}
163 @weak final const(char)* name() const nothrow 169 @weak final const(char)* name() const nothrow
164 { 170 {
@@ -173,19 +179,21 @@ else version (CppRuntime_Clang)
173 protected: 179 protected:
174 const(char)* __type_name; 180 const(char)* __type_name;
175 181
176 this(const(char)* __n) { __type_name = __n; } 182 extern(D) this(const(char)* __n) { __type_name = __n; }
177 } 183 }
178 184
179 class bad_cast : exception 185 class bad_cast : exception
180 { 186 {
181 this() nothrow {} 187 @nogc:
188 extern(D) this() nothrow {}
182 //~this(); 189 //~this();
183 @weak override const(char)* what() const nothrow { return "bad cast"; } 190 @weak override const(char)* what() const nothrow { return "bad cast"; }
184 } 191 }
185 192
186 class bad_typeid : exception 193 class bad_typeid : exception
187 { 194 {
188 this() nothrow {} 195 @nogc:
196 extern(D) this() nothrow {}
189 //~this(); 197 //~this();
190 @weak override const(char)* what() const nothrow { return "bad typeid"; } 198 @weak override const(char)* what() const nothrow { return "bad typeid"; }
191 } 199 }
diff --git a/libphobos/libdruntime/core/sys/posix/locale.d b/libphobos/libdruntime/core/sys/posix/locale.d
index 18558a2696a..85e2fb66915 100644
--- a/libphobos/libdruntime/core/sys/posix/locale.d
+++ b/libphobos/libdruntime/core/sys/posix/locale.d
@@ -31,7 +31,7 @@ version (FreeBSD)
31 version = DarwinBSDLocale; 31 version = DarwinBSDLocale;
32version (NetBSD) 32version (NetBSD)
33 version = DarwinBSDLocale; 33 version = DarwinBSDLocale;
34version (DragonflyBSD) 34version (DragonFlyBSD)
35 version = DarwinBSDLocale; 35 version = DarwinBSDLocale;
36 36
37version (CRuntime_Glibc) 37version (CRuntime_Glibc)
diff --git a/libphobos/libdruntime/object.d b/libphobos/libdruntime/object.d
index 56a2efe735a..a15616c6e0f 100644
--- a/libphobos/libdruntime/object.d
+++ b/libphobos/libdruntime/object.d
@@ -4445,7 +4445,11 @@ void destroy(bool initialize = true, T)(T obj) if (is(T == class))
4445 } 4445 }
4446 } 4446 }
4447 else 4447 else
4448 rt_finalize(cast(void*)obj); 4448 {
4449 // Bypass overloaded opCast
4450 auto ptr = (() @trusted => *cast(void**) &obj)();
4451 rt_finalize(ptr);
4452 }
4449} 4453}
4450 4454
4451/// ditto 4455/// ditto
@@ -4707,6 +4711,18 @@ nothrow unittest
4707 assert(C.dtorCount == 1); 4711 assert(C.dtorCount == 1);
4708} 4712}
4709 4713
4714// https://issues.dlang.org/show_bug.cgi?id=22832
4715nothrow unittest
4716{
4717 static struct A {}
4718 static class B
4719 {
4720 A opCast(T : A)() { return A(); }
4721 }
4722
4723 destroy(B.init);
4724}
4725
4710/// ditto 4726/// ditto
4711void destroy(bool initialize = true, T)(ref T obj) 4727void destroy(bool initialize = true, T)(ref T obj)
4712if (__traits(isStaticArray, T)) 4728if (__traits(isStaticArray, T))
diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE
index e15541e181d..5fd357c534a 100644
--- a/libphobos/src/MERGE
+++ b/libphobos/src/MERGE
@@ -1,4 +1,4 @@
141aaf8c2636df0e2e3ad39933b321d2b4cd231fa 1a1f8c4c0700ce4e256f4130ad7883c6ea3890901
2 2
3The first line of this file holds the git revision number of the last 3The first line of this file holds the git revision number of the last
4merge done from the dlang/phobos repository. 4merge done from the dlang/phobos repository.
diff --git a/libphobos/src/std/datetime/systime.d b/libphobos/src/std/datetime/systime.d
index 9b2a8443fdd..db325f727e8 100644
--- a/libphobos/src/std/datetime/systime.d
+++ b/libphobos/src/std/datetime/systime.d
@@ -8713,13 +8713,14 @@ public:
8713 8713
8714 /++ 8714 /++
8715 Creates a $(LREF SysTime) from a string with the format 8715 Creates a $(LREF SysTime) from a string with the format
8716 YYYYMMDDTHHMMSS.FFFFFFFTZ (where F is fractional seconds is the time 8716 YYYYMMDDTHHMMSS.FFFFFFFTZ (where F is fractional seconds and TZ
8717 zone). Whitespace is stripped from the given string. 8717 is the time zone). Whitespace is stripped from the given string.
8718 8718
8719 The exact format is exactly as described in `toISOString` except that 8719 The exact format is exactly as described in $(LREF toISOString) except
8720 trailing zeroes are permitted - including having fractional seconds with 8720 that trailing zeroes are permitted - including having fractional seconds
8721 all zeroes. However, a decimal point with nothing following it is 8721 with all zeroes. The time zone and fractional seconds are optional,
8722 invalid. Also, while $(LREF toISOString) will never generate a string 8722 however, a decimal point with nothing following it is invalid.
8723 Also, while $(LREF toISOString) will never generate a string
8723 with more than 7 digits in the fractional seconds (because that's the 8724 with more than 7 digits in the fractional seconds (because that's the
8724 limit with hecto-nanosecond precision), it will allow more than 7 digits 8725 limit with hecto-nanosecond precision), it will allow more than 7 digits
8725 in order to read strings from other sources that have higher precision 8726 in order to read strings from other sources that have higher precision
@@ -9024,13 +9025,14 @@ public:
9024 9025
9025 /++ 9026 /++
9026 Creates a $(LREF SysTime) from a string with the format 9027 Creates a $(LREF SysTime) from a string with the format
9027 YYYY-MM-DDTHH:MM:SS.FFFFFFFTZ (where F is fractional seconds is the 9028 YYYY-MM-DDTHH:MM:SS.FFFFFFFTZ (where F is fractional seconds and TZ
9028 time zone). Whitespace is stripped from the given string. 9029 is the time zone). Whitespace is stripped from the given string.
9029 9030
9030 The exact format is exactly as described in `toISOExtString` 9031 The exact format is exactly as described in $(LREF toISOExtString)
9031 except that trailing zeroes are permitted - including having fractional 9032 except that trailing zeroes are permitted - including having fractional
9032 seconds with all zeroes. However, a decimal point with nothing following 9033 seconds with all zeroes. The time zone and fractional seconds are
9033 it is invalid. Also, while $(LREF toISOExtString) will never generate a 9034 optional, however, a decimal point with nothing following it is invalid.
9035 Also, while $(LREF toISOExtString) will never generate a
9034 string with more than 7 digits in the fractional seconds (because that's 9036 string with more than 7 digits in the fractional seconds (because that's
9035 the limit with hecto-nanosecond precision), it will allow more than 7 9037 the limit with hecto-nanosecond precision), it will allow more than 7
9036 digits in order to read strings from other sources that have higher 9038 digits in order to read strings from other sources that have higher
@@ -9273,13 +9275,14 @@ public:
9273 9275
9274 /++ 9276 /++
9275 Creates a $(LREF SysTime) from a string with the format 9277 Creates a $(LREF SysTime) from a string with the format
9276 YYYY-MM-DD HH:MM:SS.FFFFFFFTZ (where F is fractional seconds is the 9278 YYYY-Mon-DD HH:MM:SS.FFFFFFFTZ (where F is fractional seconds and TZ
9277 time zone). Whitespace is stripped from the given string. 9279 is the time zone). Whitespace is stripped from the given string.
9278 9280
9279 The exact format is exactly as described in `toSimpleString` except 9281 The exact format is exactly as described in $(LREF toSimpleString) except
9280 that trailing zeroes are permitted - including having fractional seconds 9282 that trailing zeroes are permitted - including having fractional seconds
9281 with all zeroes. However, a decimal point with nothing following it is 9283 with all zeroes. The time zone and fractional seconds are optional,
9282 invalid. Also, while $(LREF toSimpleString) will never generate a 9284 however, a decimal point with nothing following it is invalid.
9285 Also, while $(LREF toSimpleString) will never generate a
9283 string with more than 7 digits in the fractional seconds (because that's 9286 string with more than 7 digits in the fractional seconds (because that's
9284 the limit with hecto-nanosecond precision), it will allow more than 7 9287 the limit with hecto-nanosecond precision), it will allow more than 7
9285 digits in order to read strings from other sources that have higher 9288 digits in order to read strings from other sources that have higher
diff --git a/libphobos/src/std/sumtype.d b/libphobos/src/std/sumtype.d
index 0dd636ea67b..3833c84243c 100644
--- a/libphobos/src/std/sumtype.d
+++ b/libphobos/src/std/sumtype.d
@@ -1569,27 +1569,7 @@ private enum bool isSumTypeInstance(T) = is(T == SumType!Args, Args...);
1569} 1569}
1570 1570
1571/// True if `T` is a [SumType] or implicitly converts to one, otherwise false. 1571/// True if `T` is a [SumType] or implicitly converts to one, otherwise false.
1572template isSumType(T) 1572enum bool isSumType(T) = is(T : SumType!Args, Args...);
1573{
1574 static if (is(T : SumType!Args, Args...))
1575 {
1576 enum isSumType = true;
1577 }
1578 else static if (is(T == struct) && __traits(getAliasThis, T).length > 0)
1579 {
1580 // Workaround for https://issues.dlang.org/show_bug.cgi?id=21975
1581 import std.traits : ReturnType;
1582
1583 alias AliasThisType = ReturnType!((T t) =>
1584 __traits(getMember, t, __traits(getAliasThis, T)[0])
1585 );
1586 enum isSumType = .isSumType!AliasThisType;
1587 }
1588 else
1589 {
1590 enum isSumType = false;
1591 }
1592}
1593 1573
1594/// 1574///
1595@safe unittest 1575@safe unittest
@@ -1610,25 +1590,6 @@ template isSumType(T)
1610 assert(!isSumType!ContainsSumType); 1590 assert(!isSumType!ContainsSumType);
1611} 1591}
1612 1592
1613@safe unittest
1614{
1615 static struct AliasThisVar(T)
1616 {
1617 SumType!T payload;
1618 alias payload this;
1619 }
1620
1621 static struct AliasThisFunc(T)
1622 {
1623 SumType!T payload;
1624 ref get() { return payload; }
1625 alias get this;
1626 }
1627
1628 static assert(isSumType!(AliasThisVar!int));
1629 static assert(isSumType!(AliasThisFunc!int));
1630}
1631
1632/** 1593/**
1633 * Calls a type-appropriate function with the value held in a [SumType]. 1594 * Calls a type-appropriate function with the value held in a [SumType].
1634 * 1595 *