aboutsummaryrefslogtreecommitdiff
path: root/libphobos/testsuite/libphobos.traits
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2021-12-15 19:47:02 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2021-12-15 19:51:30 +0100
commitfd43568cc54e17c8b4a845677872c6282bc6dbb7 (patch)
tree24f591392a2978706aef4d58e377b8b42b5ba418 /libphobos/testsuite/libphobos.traits
parent639ece7abfa3688008cb791aec4c7a1a4f76e59f (diff)
downloadgcc-fd43568cc54e17c8b4a845677872c6282bc6dbb7.zip
gcc-fd43568cc54e17c8b4a845677872c6282bc6dbb7.tar.gz
gcc-fd43568cc54e17c8b4a845677872c6282bc6dbb7.tar.bz2
d: Merge upstream dmd 93108bb9e, druntime 6364e010, phobos 575b67a9b.
D front-end changes: - Import dmd v2.098.1-beta.1. - Default extern(C++) compatibility to C++17. Druntime changes: - Import druntime v2.098.1-beta.1. - Fix definition of stat_t on MIPS64 (PR103604) Phobos changes: - Import phobos v2.098.1-beta.1. gcc/d/ChangeLog: * d-lang.cc (d_init_options): Set default -fextern-std= to C++17. * dmd/MERGE: Merge upstream dmd 93108bb9e. * gdc.texi (Runtime Options): Document the default for -fextern-std=. libphobos/ChangeLog: PR d/103604 * configure: Regenerate. * configure.ac (libtool_VERSION): Update to 3:0:0. * libdruntime/MERGE: Merge upstream druntime 6364e010. * src/MERGE: Merge upstream phobos 575b67a9b. * testsuite/libphobos.traits/all_satisfy.d: New test. * testsuite/libphobos.traits/traits.exp: New test.
Diffstat (limited to 'libphobos/testsuite/libphobos.traits')
-rw-r--r--libphobos/testsuite/libphobos.traits/all_satisfy.d24
-rw-r--r--libphobos/testsuite/libphobos.traits/traits.exp27
2 files changed, 51 insertions, 0 deletions
diff --git a/libphobos/testsuite/libphobos.traits/all_satisfy.d b/libphobos/testsuite/libphobos.traits/all_satisfy.d
new file mode 100644
index 0000000..2c008ce
--- /dev/null
+++ b/libphobos/testsuite/libphobos.traits/all_satisfy.d
@@ -0,0 +1,24 @@
+// https://issues.dlang.org/show_bug.cgi?id=22210
+
+import core.internal.traits : allSatisfy;
+
+enum isHashable(T) = __traits(compiles,
+ () { T.init; }
+);
+
+class A
+{
+ static if (isHashable!B) {}
+}
+
+class B
+{
+ static if (isHashable!C) {}
+}
+
+class C
+{
+ static if (allSatisfy!(isHashable, int, B)) {}
+}
+
+void main() {}
diff --git a/libphobos/testsuite/libphobos.traits/traits.exp b/libphobos/testsuite/libphobos.traits/traits.exp
new file mode 100644
index 0000000..cb78538
--- /dev/null
+++ b/libphobos/testsuite/libphobos.traits/traits.exp
@@ -0,0 +1,27 @@
+# Copyright (C) 2021 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# Initialize dg.
+dg-init
+
+# Gather a list of all tests.
+set tests [lsort [find $srcdir/$subdir *.d]]
+
+# Main loop.
+dg-runtest $tests "" $DEFAULT_DFLAGS
+
+# All done.
+dg-finish