diff mbox series

[committed,3/3] libphobos: Merge upstream druntime 483bc129, phobos f89dc217a.

Message ID 20210403233001.1822715-1-ibuclaw@gdcproject.org
State New
Headers show
Series [committed,1/3] d: Merge upstream dmd 3b808e838 | expand

Commit Message

Iain Buclaw April 3, 2021, 11:30 p.m. UTC
Hi,

This patch is part of merging the Phobos standard library with upstream
druntime 483bc129 and phobos f89dc217a.

Phobos changes:

 - Synchronize C bindings with the latest port fixes in upstream druntime.

 - Added alias for a `noreturn' type in object.d

 - Make use of the new `pragma(printf)' and `pragma(scanf)' pragmas, fix
   all code that got flagged as being incorrect.

 - Fixed code that relied on bugs in the D import package system.

Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32 and
committed to mainline.

Regards,
Iain.

---
libphobos/ChangeLog:

	* libdruntime/MERGE: Merge upstream druntime 483bc129.
	* libdruntime/Makefile.am (DRUNTIME_DSOURCES_DARWIN): Add
	core/sys/darwin/fcntl.d.
	(DRUNTIME_DSOURCES_OPENBSD): Add core/sys/openbsd/unistd.d.
	(DRUNTIME_DSOURCES_WINDOWS): Add core/sys/windows/stdc/malloc.d.
	* libdruntime/Makefile.in: Regenerate.
	* src/MERGE: Merge upstream phobos f89dc217a.
	* src/Makefile.am (PHOBOS_DSOURCES): Add std/regex/internal/tests2.d.
	* src/Makefile.in: Regenerate.
	* testsuite/libphobos.exceptions/chain.d: Fix format arguments.
	* testsuite/libphobos.exceptions/line_trace.d: Likewise.
---
 libphobos/libdruntime/MERGE                   |   2 +-
 libphobos/libdruntime/Makefile.am             |  58 +-
 libphobos/libdruntime/Makefile.in             | 105 +--
 libphobos/libdruntime/core/stdc/complex.d     |  70 +-
 libphobos/libdruntime/core/stdc/config.d      |  43 ++
 libphobos/libdruntime/core/stdc/errno.d       |  16 +-
 libphobos/libdruntime/core/stdc/math.d        | 400 +++++------
 libphobos/libdruntime/core/stdc/stdio.d       |  61 +-
 libphobos/libdruntime/core/stdc/stdlib.d      |   6 +-
 libphobos/libdruntime/core/stdc/tgmath.d      | 653 +++++++----------
 libphobos/libdruntime/core/stdc/wchar_.d      |   9 +-
 libphobos/libdruntime/core/sys/darwin/fcntl.d |  20 +
 libphobos/libdruntime/core/sys/linux/epoll.d  |  88 ++-
 .../libdruntime/core/sys/openbsd/string.d     |   2 +
 .../libdruntime/core/sys/openbsd/unistd.d     |  17 +
 libphobos/libdruntime/core/sys/posix/config.d |   1 +
 libphobos/libdruntime/core/sys/posix/dlfcn.d  |  11 +-
 libphobos/libdruntime/core/sys/posix/signal.d |  14 +-
 libphobos/libdruntime/core/sys/posix/unistd.d |  48 ++
 libphobos/libdruntime/core/sys/windows/com.d  |  20 +-
 libphobos/libdruntime/core/sys/windows/dll.d  |  12 +-
 .../core/sys/windows/stdc/malloc.d            |  26 +
 .../libdruntime/gc/impl/conservative/gc.d     |   4 +-
 libphobos/libdruntime/object.d                |   7 +-
 libphobos/src/MERGE                           |   2 +-
 libphobos/src/Makefile.am                     |  12 +-
 libphobos/src/Makefile.in                     |  14 +-
 libphobos/src/std/algorithm/iteration.d       |   8 +-
 libphobos/src/std/algorithm/searching.d       |   4 +-
 libphobos/src/std/container/rbtree.d          |   4 +-
 libphobos/src/std/conv.d                      |   2 +-
 libphobos/src/std/datetime/systime.d          |   4 +-
 .../src/std/experimental/logger/nulllogger.d  |   2 +-
 libphobos/src/std/experimental/typecons.d     |   6 +-
 libphobos/src/std/file.d                      |   5 +-
 libphobos/src/std/format.d                    |   4 +-
 libphobos/src/std/internal/math/biguintcore.d |   4 +-
 libphobos/src/std/math.d                      |   4 +-
 libphobos/src/std/parallelism.d               |   4 +-
 libphobos/src/std/range/package.d             |   1 -
 libphobos/src/std/regex/internal/tests.d      | 653 +----------------
 libphobos/src/std/regex/internal/tests2.d     | 662 ++++++++++++++++++
 libphobos/src/std/socket.d                    |   2 +-
 libphobos/src/std/typecons.d                  |  10 +-
 libphobos/src/std/zip.d                       |   6 +-
 .../testsuite/libphobos.exceptions/chain.d    |   4 +-
 .../libphobos.exceptions/line_trace.d         |   2 +-
 47 files changed, 1568 insertions(+), 1544 deletions(-)
 create mode 100644 libphobos/libdruntime/core/sys/darwin/fcntl.d
 create mode 100644 libphobos/libdruntime/core/sys/openbsd/unistd.d
 create mode 100644 libphobos/libdruntime/core/sys/windows/stdc/malloc.d
 create mode 100644 libphobos/src/std/regex/internal/tests2.d
diff mbox series

Patch

diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index a4a9a940baf..b797682a4d9 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@ 
-0fd4364c4a4eb2ce0ebb8f613092c5bed7a63bf9
+483bc12977af3c1288fd52e7b4fa14b716896c5a
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/druntime repository.
diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am
index 535ca26e860..2a5c793d7c1 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -208,16 +208,17 @@  DRUNTIME_DSOURCES_BIONIC = core/sys/bionic/err.d \
 
 DRUNTIME_DSOURCES_DARWIN = core/sys/darwin/crt_externs.d \
 	core/sys/darwin/dlfcn.d core/sys/darwin/err.d \
-	core/sys/darwin/execinfo.d core/sys/darwin/ifaddrs.d \
-	core/sys/darwin/mach/dyld.d core/sys/darwin/mach/getsect.d \
-	core/sys/darwin/mach/kern_return.d core/sys/darwin/mach/loader.d \
-	core/sys/darwin/mach/nlist.d core/sys/darwin/mach/port.d \
-	core/sys/darwin/mach/semaphore.d core/sys/darwin/mach/stab.d \
-	core/sys/darwin/mach/thread_act.d core/sys/darwin/netinet/in_.d \
-	core/sys/darwin/pthread.d core/sys/darwin/stdlib.d \
-	core/sys/darwin/string.d core/sys/darwin/sys/attr.d \
-	core/sys/darwin/sys/cdefs.d core/sys/darwin/sys/event.d \
-	core/sys/darwin/sys/mman.d core/sys/darwin/sys/sysctl.d
+	core/sys/darwin/execinfo.d core/sys/darwin/fcntl.d \
+	core/sys/darwin/ifaddrs.d core/sys/darwin/mach/dyld.d \
+	core/sys/darwin/mach/getsect.d core/sys/darwin/mach/kern_return.d \
+	core/sys/darwin/mach/loader.d core/sys/darwin/mach/nlist.d \
+	core/sys/darwin/mach/port.d core/sys/darwin/mach/semaphore.d \
+	core/sys/darwin/mach/stab.d core/sys/darwin/mach/thread_act.d \
+	core/sys/darwin/netinet/in_.d core/sys/darwin/pthread.d \
+	core/sys/darwin/stdlib.d core/sys/darwin/string.d \
+	core/sys/darwin/sys/attr.d core/sys/darwin/sys/cdefs.d \
+	core/sys/darwin/sys/event.d core/sys/darwin/sys/mman.d \
+	core/sys/darwin/sys/sysctl.d
 
 DRUNTIME_DSOURCES_DRAGONFLYBSD = core/sys/dragonflybsd/dlfcn.d \
 	core/sys/dragonflybsd/err.d core/sys/dragonflybsd/execinfo.d \
@@ -275,7 +276,8 @@  DRUNTIME_DSOURCES_OPENBSD = core/sys/openbsd/dlfcn.d \
 	core/sys/openbsd/sys/elf.d core/sys/openbsd/sys/elf32.d \
 	core/sys/openbsd/sys/elf64.d core/sys/openbsd/sys/elf_common.d \
 	core/sys/openbsd/sys/link_elf.d core/sys/openbsd/sys/mman.d \
-	core/sys/openbsd/sys/sysctl.d core/sys/openbsd/time.d
+	core/sys/openbsd/sys/sysctl.d core/sys/openbsd/time.d \
+	core/sys/openbsd/unistd.d
 
 DRUNTIME_DSOURCES_POSIX = core/sys/posix/aio.d \
 	core/sys/posix/arpa/inet.d core/sys/posix/config.d \
@@ -382,22 +384,22 @@  DRUNTIME_DSOURCES_WINDOWS = core/sys/windows/accctrl.d \
 	core/sys/windows/sqlext.d core/sys/windows/sqltypes.d \
 	core/sys/windows/sqlucode.d core/sys/windows/sspi.d \
 	core/sys/windows/stacktrace.d core/sys/windows/stat.d \
-	core/sys/windows/stdc/time.d core/sys/windows/subauth.d \
-	core/sys/windows/threadaux.d core/sys/windows/tlhelp32.d \
-	core/sys/windows/tmschema.d core/sys/windows/unknwn.d \
-	core/sys/windows/uuid.d core/sys/windows/vfw.d \
-	core/sys/windows/w32api.d core/sys/windows/winbase.d \
-	core/sys/windows/winber.d core/sys/windows/wincon.d \
-	core/sys/windows/wincrypt.d core/sys/windows/windef.d \
-	core/sys/windows/windows.d core/sys/windows/winerror.d \
-	core/sys/windows/wingdi.d core/sys/windows/winhttp.d \
-	core/sys/windows/wininet.d core/sys/windows/winioctl.d \
-	core/sys/windows/winldap.d core/sys/windows/winnetwk.d \
-	core/sys/windows/winnls.d core/sys/windows/winnt.d \
-	core/sys/windows/winperf.d core/sys/windows/winreg.d \
-	core/sys/windows/winsock2.d core/sys/windows/winspool.d \
-	core/sys/windows/winsvc.d core/sys/windows/winuser.d \
-	core/sys/windows/winver.d core/sys/windows/wtsapi32.d \
-	core/sys/windows/wtypes.d
+	core/sys/windows/stdc/malloc.d core/sys/windows/stdc/time.d \
+	core/sys/windows/subauth.d core/sys/windows/threadaux.d \
+	core/sys/windows/tlhelp32.d core/sys/windows/tmschema.d \
+	core/sys/windows/unknwn.d core/sys/windows/uuid.d \
+	core/sys/windows/vfw.d core/sys/windows/w32api.d \
+	core/sys/windows/winbase.d core/sys/windows/winber.d \
+	core/sys/windows/wincon.d core/sys/windows/wincrypt.d \
+	core/sys/windows/windef.d core/sys/windows/windows.d \
+	core/sys/windows/winerror.d core/sys/windows/wingdi.d \
+	core/sys/windows/winhttp.d core/sys/windows/wininet.d \
+	core/sys/windows/winioctl.d core/sys/windows/winldap.d \
+	core/sys/windows/winnetwk.d core/sys/windows/winnls.d \
+	core/sys/windows/winnt.d core/sys/windows/winperf.d \
+	core/sys/windows/winreg.d core/sys/windows/winsock2.d \
+	core/sys/windows/winspool.d core/sys/windows/winsvc.d \
+	core/sys/windows/winuser.d core/sys/windows/winver.d \
+	core/sys/windows/wtsapi32.d core/sys/windows/wtypes.d
 
 DRUNTIME_DISOURCES = __entrypoint.di __main.di
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index 7960add41d8..b00fe022cfa 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -256,8 +256,9 @@  am__objects_3 = core/sys/posix/aio.lo core/sys/posix/arpa/inet.lo \
 @DRUNTIME_OS_POSIX_TRUE@am__objects_4 = $(am__objects_3)
 am__objects_5 = core/sys/darwin/crt_externs.lo \
 	core/sys/darwin/dlfcn.lo core/sys/darwin/err.lo \
-	core/sys/darwin/execinfo.lo core/sys/darwin/ifaddrs.lo \
-	core/sys/darwin/mach/dyld.lo core/sys/darwin/mach/getsect.lo \
+	core/sys/darwin/execinfo.lo core/sys/darwin/fcntl.lo \
+	core/sys/darwin/ifaddrs.lo core/sys/darwin/mach/dyld.lo \
+	core/sys/darwin/mach/getsect.lo \
 	core/sys/darwin/mach/kern_return.lo \
 	core/sys/darwin/mach/loader.lo core/sys/darwin/mach/nlist.lo \
 	core/sys/darwin/mach/port.lo core/sys/darwin/mach/semaphore.lo \
@@ -322,7 +323,8 @@  am__objects_15 = core/sys/openbsd/dlfcn.lo core/sys/openbsd/err.lo \
 	core/sys/openbsd/sys/elf32.lo core/sys/openbsd/sys/elf64.lo \
 	core/sys/openbsd/sys/elf_common.lo \
 	core/sys/openbsd/sys/link_elf.lo core/sys/openbsd/sys/mman.lo \
-	core/sys/openbsd/sys/sysctl.lo core/sys/openbsd/time.lo
+	core/sys/openbsd/sys/sysctl.lo core/sys/openbsd/time.lo \
+	core/sys/openbsd/unistd.lo
 @DRUNTIME_OS_OPENBSD_TRUE@am__objects_16 = $(am__objects_15)
 am__objects_17 = core/sys/linux/config.lo core/sys/linux/dlfcn.lo \
 	core/sys/linux/elf.lo core/sys/linux/epoll.lo \
@@ -408,23 +410,24 @@  am__objects_19 = core/sys/windows/accctrl.lo \
 	core/sys/windows/sql.lo core/sys/windows/sqlext.lo \
 	core/sys/windows/sqltypes.lo core/sys/windows/sqlucode.lo \
 	core/sys/windows/sspi.lo core/sys/windows/stacktrace.lo \
-	core/sys/windows/stat.lo core/sys/windows/stdc/time.lo \
-	core/sys/windows/subauth.lo core/sys/windows/threadaux.lo \
-	core/sys/windows/tlhelp32.lo core/sys/windows/tmschema.lo \
-	core/sys/windows/unknwn.lo core/sys/windows/uuid.lo \
-	core/sys/windows/vfw.lo core/sys/windows/w32api.lo \
-	core/sys/windows/winbase.lo core/sys/windows/winber.lo \
-	core/sys/windows/wincon.lo core/sys/windows/wincrypt.lo \
-	core/sys/windows/windef.lo core/sys/windows/windows.lo \
-	core/sys/windows/winerror.lo core/sys/windows/wingdi.lo \
-	core/sys/windows/winhttp.lo core/sys/windows/wininet.lo \
-	core/sys/windows/winioctl.lo core/sys/windows/winldap.lo \
-	core/sys/windows/winnetwk.lo core/sys/windows/winnls.lo \
-	core/sys/windows/winnt.lo core/sys/windows/winperf.lo \
-	core/sys/windows/winreg.lo core/sys/windows/winsock2.lo \
-	core/sys/windows/winspool.lo core/sys/windows/winsvc.lo \
-	core/sys/windows/winuser.lo core/sys/windows/winver.lo \
-	core/sys/windows/wtsapi32.lo core/sys/windows/wtypes.lo
+	core/sys/windows/stat.lo core/sys/windows/stdc/malloc.lo \
+	core/sys/windows/stdc/time.lo core/sys/windows/subauth.lo \
+	core/sys/windows/threadaux.lo core/sys/windows/tlhelp32.lo \
+	core/sys/windows/tmschema.lo core/sys/windows/unknwn.lo \
+	core/sys/windows/uuid.lo core/sys/windows/vfw.lo \
+	core/sys/windows/w32api.lo core/sys/windows/winbase.lo \
+	core/sys/windows/winber.lo core/sys/windows/wincon.lo \
+	core/sys/windows/wincrypt.lo core/sys/windows/windef.lo \
+	core/sys/windows/windows.lo core/sys/windows/winerror.lo \
+	core/sys/windows/wingdi.lo core/sys/windows/winhttp.lo \
+	core/sys/windows/wininet.lo core/sys/windows/winioctl.lo \
+	core/sys/windows/winldap.lo core/sys/windows/winnetwk.lo \
+	core/sys/windows/winnls.lo core/sys/windows/winnt.lo \
+	core/sys/windows/winperf.lo core/sys/windows/winreg.lo \
+	core/sys/windows/winsock2.lo core/sys/windows/winspool.lo \
+	core/sys/windows/winsvc.lo core/sys/windows/winuser.lo \
+	core/sys/windows/winver.lo core/sys/windows/wtsapi32.lo \
+	core/sys/windows/wtypes.lo
 @DRUNTIME_OS_MINGW_TRUE@am__objects_20 = $(am__objects_19)
 am__objects_21 = core/sys/solaris/dlfcn.lo core/sys/solaris/elf.lo \
 	core/sys/solaris/err.lo core/sys/solaris/execinfo.lo \
@@ -837,16 +840,17 @@  DRUNTIME_DSOURCES_BIONIC = core/sys/bionic/err.d \
 
 DRUNTIME_DSOURCES_DARWIN = core/sys/darwin/crt_externs.d \
 	core/sys/darwin/dlfcn.d core/sys/darwin/err.d \
-	core/sys/darwin/execinfo.d core/sys/darwin/ifaddrs.d \
-	core/sys/darwin/mach/dyld.d core/sys/darwin/mach/getsect.d \
-	core/sys/darwin/mach/kern_return.d core/sys/darwin/mach/loader.d \
-	core/sys/darwin/mach/nlist.d core/sys/darwin/mach/port.d \
-	core/sys/darwin/mach/semaphore.d core/sys/darwin/mach/stab.d \
-	core/sys/darwin/mach/thread_act.d core/sys/darwin/netinet/in_.d \
-	core/sys/darwin/pthread.d core/sys/darwin/stdlib.d \
-	core/sys/darwin/string.d core/sys/darwin/sys/attr.d \
-	core/sys/darwin/sys/cdefs.d core/sys/darwin/sys/event.d \
-	core/sys/darwin/sys/mman.d core/sys/darwin/sys/sysctl.d
+	core/sys/darwin/execinfo.d core/sys/darwin/fcntl.d \
+	core/sys/darwin/ifaddrs.d core/sys/darwin/mach/dyld.d \
+	core/sys/darwin/mach/getsect.d core/sys/darwin/mach/kern_return.d \
+	core/sys/darwin/mach/loader.d core/sys/darwin/mach/nlist.d \
+	core/sys/darwin/mach/port.d core/sys/darwin/mach/semaphore.d \
+	core/sys/darwin/mach/stab.d core/sys/darwin/mach/thread_act.d \
+	core/sys/darwin/netinet/in_.d core/sys/darwin/pthread.d \
+	core/sys/darwin/stdlib.d core/sys/darwin/string.d \
+	core/sys/darwin/sys/attr.d core/sys/darwin/sys/cdefs.d \
+	core/sys/darwin/sys/event.d core/sys/darwin/sys/mman.d \
+	core/sys/darwin/sys/sysctl.d
 
 DRUNTIME_DSOURCES_DRAGONFLYBSD = core/sys/dragonflybsd/dlfcn.d \
 	core/sys/dragonflybsd/err.d core/sys/dragonflybsd/execinfo.d \
@@ -904,7 +908,8 @@  DRUNTIME_DSOURCES_OPENBSD = core/sys/openbsd/dlfcn.d \
 	core/sys/openbsd/sys/elf.d core/sys/openbsd/sys/elf32.d \
 	core/sys/openbsd/sys/elf64.d core/sys/openbsd/sys/elf_common.d \
 	core/sys/openbsd/sys/link_elf.d core/sys/openbsd/sys/mman.d \
-	core/sys/openbsd/sys/sysctl.d core/sys/openbsd/time.d
+	core/sys/openbsd/sys/sysctl.d core/sys/openbsd/time.d \
+	core/sys/openbsd/unistd.d
 
 DRUNTIME_DSOURCES_POSIX = core/sys/posix/aio.d \
 	core/sys/posix/arpa/inet.d core/sys/posix/config.d \
@@ -1011,23 +1016,23 @@  DRUNTIME_DSOURCES_WINDOWS = core/sys/windows/accctrl.d \
 	core/sys/windows/sqlext.d core/sys/windows/sqltypes.d \
 	core/sys/windows/sqlucode.d core/sys/windows/sspi.d \
 	core/sys/windows/stacktrace.d core/sys/windows/stat.d \
-	core/sys/windows/stdc/time.d core/sys/windows/subauth.d \
-	core/sys/windows/threadaux.d core/sys/windows/tlhelp32.d \
-	core/sys/windows/tmschema.d core/sys/windows/unknwn.d \
-	core/sys/windows/uuid.d core/sys/windows/vfw.d \
-	core/sys/windows/w32api.d core/sys/windows/winbase.d \
-	core/sys/windows/winber.d core/sys/windows/wincon.d \
-	core/sys/windows/wincrypt.d core/sys/windows/windef.d \
-	core/sys/windows/windows.d core/sys/windows/winerror.d \
-	core/sys/windows/wingdi.d core/sys/windows/winhttp.d \
-	core/sys/windows/wininet.d core/sys/windows/winioctl.d \
-	core/sys/windows/winldap.d core/sys/windows/winnetwk.d \
-	core/sys/windows/winnls.d core/sys/windows/winnt.d \
-	core/sys/windows/winperf.d core/sys/windows/winreg.d \
-	core/sys/windows/winsock2.d core/sys/windows/winspool.d \
-	core/sys/windows/winsvc.d core/sys/windows/winuser.d \
-	core/sys/windows/winver.d core/sys/windows/wtsapi32.d \
-	core/sys/windows/wtypes.d
+	core/sys/windows/stdc/malloc.d core/sys/windows/stdc/time.d \
+	core/sys/windows/subauth.d core/sys/windows/threadaux.d \
+	core/sys/windows/tlhelp32.d core/sys/windows/tmschema.d \
+	core/sys/windows/unknwn.d core/sys/windows/uuid.d \
+	core/sys/windows/vfw.d core/sys/windows/w32api.d \
+	core/sys/windows/winbase.d core/sys/windows/winber.d \
+	core/sys/windows/wincon.d core/sys/windows/wincrypt.d \
+	core/sys/windows/windef.d core/sys/windows/windows.d \
+	core/sys/windows/winerror.d core/sys/windows/wingdi.d \
+	core/sys/windows/winhttp.d core/sys/windows/wininet.d \
+	core/sys/windows/winioctl.d core/sys/windows/winldap.d \
+	core/sys/windows/winnetwk.d core/sys/windows/winnls.d \
+	core/sys/windows/winnt.d core/sys/windows/winperf.d \
+	core/sys/windows/winreg.d core/sys/windows/winsock2.d \
+	core/sys/windows/winspool.d core/sys/windows/winsvc.d \
+	core/sys/windows/winuser.d core/sys/windows/winver.d \
+	core/sys/windows/wtsapi32.d core/sys/windows/wtypes.d
 
 DRUNTIME_DISOURCES = __entrypoint.di __main.di
 all: all-am
@@ -1346,6 +1351,7 @@  core/sys/darwin/crt_externs.lo: core/sys/darwin/$(am__dirstamp)
 core/sys/darwin/dlfcn.lo: core/sys/darwin/$(am__dirstamp)
 core/sys/darwin/err.lo: core/sys/darwin/$(am__dirstamp)
 core/sys/darwin/execinfo.lo: core/sys/darwin/$(am__dirstamp)
+core/sys/darwin/fcntl.lo: core/sys/darwin/$(am__dirstamp)
 core/sys/darwin/ifaddrs.lo: core/sys/darwin/$(am__dirstamp)
 core/sys/darwin/mach/$(am__dirstamp):
 	@$(MKDIR_P) core/sys/darwin/mach
@@ -1510,6 +1516,7 @@  core/sys/openbsd/sys/link_elf.lo:  \
 core/sys/openbsd/sys/mman.lo: core/sys/openbsd/sys/$(am__dirstamp)
 core/sys/openbsd/sys/sysctl.lo: core/sys/openbsd/sys/$(am__dirstamp)
 core/sys/openbsd/time.lo: core/sys/openbsd/$(am__dirstamp)
+core/sys/openbsd/unistd.lo: core/sys/openbsd/$(am__dirstamp)
 core/sys/linux/$(am__dirstamp):
 	@$(MKDIR_P) core/sys/linux
 	@: > core/sys/linux/$(am__dirstamp)
@@ -1690,6 +1697,8 @@  core/sys/windows/stat.lo: core/sys/windows/$(am__dirstamp)
 core/sys/windows/stdc/$(am__dirstamp):
 	@$(MKDIR_P) core/sys/windows/stdc
 	@: > core/sys/windows/stdc/$(am__dirstamp)
+core/sys/windows/stdc/malloc.lo:  \
+	core/sys/windows/stdc/$(am__dirstamp)
 core/sys/windows/stdc/time.lo: core/sys/windows/stdc/$(am__dirstamp)
 core/sys/windows/subauth.lo: core/sys/windows/$(am__dirstamp)
 core/sys/windows/threadaux.lo: core/sys/windows/$(am__dirstamp)
diff --git a/libphobos/libdruntime/core/stdc/complex.d b/libphobos/libdruntime/core/stdc/complex.d
index d878366b3bd..b84651f3f15 100644
--- a/libphobos/libdruntime/core/stdc/complex.d
+++ b/libphobos/libdruntime/core/stdc/complex.d
@@ -19,163 +19,97 @@  extern (C):
 nothrow:
 @nogc:
 
-///
+// @@@DEPRECATED_2.105@@@
+deprecated:
 alias creal complex;
-///
 alias ireal imaginary;
-///
 cdouble cacos(cdouble z);
-///
 cfloat  cacosf(cfloat z);
-///
 creal   cacosl(creal z);
 
-///
 cdouble casin(cdouble z);
-///
 cfloat  casinf(cfloat z);
-///
 creal   casinl(creal z);
 
-///
 cdouble catan(cdouble z);
-///
 cfloat  catanf(cfloat z);
-///
 creal   catanl(creal z);
 
-///
 cdouble ccos(cdouble z);
-///
 cfloat  ccosf(cfloat z);
-///
 creal   ccosl(creal z);
 
-///
 cdouble csin(cdouble z);
-///
 cfloat  csinf(cfloat z);
-///
 creal   csinl(creal z);
 
-///
 cdouble ctan(cdouble z);
-///
 cfloat  ctanf(cfloat z);
-///
 creal   ctanl(creal z);
 
-///
 cdouble cacosh(cdouble z);
-///
 cfloat  cacoshf(cfloat z);
-///
 creal   cacoshl(creal z);
 
-///
 cdouble casinh(cdouble z);
-///
 cfloat  casinhf(cfloat z);
-///
 creal   casinhl(creal z);
 
-///
 cdouble catanh(cdouble z);
-///
 cfloat  catanhf(cfloat z);
-///
 creal   catanhl(creal z);
 
-///
 cdouble ccosh(cdouble z);
-///
 cfloat  ccoshf(cfloat z);
-///
 creal   ccoshl(creal z);
 
-///
 cdouble csinh(cdouble z);
-///
 cfloat  csinhf(cfloat z);
-///
 creal   csinhl(creal z);
 
-///
 cdouble ctanh(cdouble z);
-///
 cfloat  ctanhf(cfloat z);
-///
 creal   ctanhl(creal z);
 
-///
 cdouble cexp(cdouble z);
-///
 cfloat  cexpf(cfloat z);
-///
 creal   cexpl(creal z);
 
-///
 cdouble clog(cdouble z);
-///
 cfloat  clogf(cfloat z);
-///
 creal   clogl(creal z);
 
-///
  double cabs(cdouble z);
- ///
  float  cabsf(cfloat z);
- ///
  real   cabsl(creal z);
 
- ///
 cdouble cpow(cdouble x, cdouble y);
-///
 cfloat  cpowf(cfloat x, cfloat y);
-///
 creal   cpowl(creal x, creal y);
 
-///
 cdouble csqrt(cdouble z);
-///
 cfloat  csqrtf(cfloat z);
-///
 creal   csqrtl(creal z);
 
-///
  double carg(cdouble z);
- ///
  float  cargf(cfloat z);
- ///
  real   cargl(creal z);
 
-///
 pragma(inline, true) double cimag(cdouble z) { return z.im; }
-///
 pragma(inline, true) float  cimagf(cfloat z) { return z.im; }
-///
 pragma(inline, true) real   cimagl(creal z)  { return z.im; }
 
-///
 cdouble conj(cdouble z);
-///
 cfloat  conjf(cfloat z);
-///
 creal   conjl(creal z);
 
-///
 cdouble cproj(cdouble z);
-///
 cfloat  cprojf(cfloat z);
-///
 creal   cprojl(creal z);
 
 // Note: `creal` is a keyword in D and so this function is inaccessible, use `creald` instead
 //pragma(inline, true) double creal(cdouble z) { return z.re; }
 
-///
 pragma(inline, true) double creald(cdouble z) { return z.re; }
-///
 pragma(inline, true) float  crealf(cfloat z) { return z.re; }
-///
 pragma(inline, true) real   creall(creal z)  { return z.re; }
diff --git a/libphobos/libdruntime/core/stdc/config.d b/libphobos/libdruntime/core/stdc/config.d
index cdb987f1415..802f5b6fb21 100644
--- a/libphobos/libdruntime/core/stdc/config.d
+++ b/libphobos/libdruntime/core/stdc/config.d
@@ -34,6 +34,7 @@  version (StdDdoc)
             alias ddoc_long = int;
             alias ddoc_ulong = uint;
         }
+        struct ddoc_complex(T) { T re; T im; };
     }
 
     /***
@@ -89,6 +90,24 @@  version (StdDdoc)
      * C++ compiler's `ptrdiff_t` type.
      */
     alias cpp_ptrdiff_t = ptrdiff_t;
+
+    /***
+     * Used for a complex floating point type that corresponds in size and ABI to the associated
+     * C compiler's `_Complex float` type.
+     */
+    alias c_complex_float = ddoc_complex!float;
+
+    /***
+     * Used for a complex floating point type that corresponds in size and ABI to the associated
+     * C compiler's `_Complex double` type.
+     */
+    alias c_complex_double = ddoc_complex!double;
+
+    /***
+     * Used for a complex floating point type that corresponds in size and ABI to the associated
+     * C compiler's `_Complex long double` type.
+     */
+    alias c_complex_real = ddoc_complex!real;
 }
 else
 {
@@ -230,4 +249,28 @@  else
     alias cpp_size_t = size_t;
     alias cpp_ptrdiff_t = ptrdiff_t;
 }
+
+// ABI layout of native complex types.
+private struct _Complex(T)
+{
+    T re;
+    T im;
+}
+
+version (Posix)
+{
+    align(float.alignof)  enum __c_complex_float : _Complex!float;
+    align(double.alignof) enum __c_complex_double : _Complex!double;
+    align(real.alignof)   enum __c_complex_real : _Complex!real;
+}
+else
+{
+    align(float.sizeof * 2)  enum __c_complex_float : _Complex!float;
+    align(double.sizeof * 2) enum __c_complex_double : _Complex!double;
+    align(real.alignof)      enum __c_complex_real : _Complex!real;
+}
+
+alias c_complex_float = __c_complex_float;
+alias c_complex_double = __c_complex_double;
+alias c_complex_real = __c_complex_real;
 }
diff --git a/libphobos/libdruntime/core/stdc/errno.d b/libphobos/libdruntime/core/stdc/errno.d
index 31f7d11c762..57bc15da6eb 100644
--- a/libphobos/libdruntime/core/stdc/errno.d
+++ b/libphobos/libdruntime/core/stdc/errno.d
@@ -156,15 +156,9 @@  else version (Haiku)
 else
 {
     ///
-    @property int errno() { return getErrno(); }
+    extern(C) pragma(mangle, "getErrno") @property int errno();
     ///
-    @property int errno(int n) { return setErrno(n); }
-
-    extern (C)
-    {
-        private int getErrno();      // for internal use
-        private int setErrno(int);   // for internal use
-    }
+    extern(C) pragma(mangle, "setErrno") @property int errno(int n);
 }
 
 extern (C):
@@ -1532,7 +1526,11 @@  else version (OpenBSD)
     enum EIDRM              = 89;       /// Identifier removed
     enum ENOMSG             = 90;       /// No message of desired type
     enum ENOTSUP            = 91;       /// Not supported
-    enum ELAST              = 91;       /// Must be equal largest errno
+    enum EBADMSG            = 92;       /// Bad message
+    enum ENOTRECOVERABLE    = 93;       /// State not recoverable
+    enum EOWNERDEAD         = 94;       /// Previous owner died
+    enum EPROTO             = 95;       /// Protocol error
+    enum ELAST              = 95;       /// Must be equal largest errno
 }
 else version (DragonFlyBSD)
 {
diff --git a/libphobos/libdruntime/core/stdc/math.d b/libphobos/libdruntime/core/stdc/math.d
index e8d1fa8e7b5..fba78ee233a 100644
--- a/libphobos/libdruntime/core/stdc/math.d
+++ b/libphobos/libdruntime/core/stdc/math.d
@@ -319,16 +319,12 @@  version (CRuntime_DigitalMars)
   {
     //int fpclassify(real-floating x);
     ///
-    pure int fpclassify(float x)     { return __fpclassify_f(x); }
+    extern(C) pragma(mangle, "__fpclassify_f") pure int fpclassify(float x);
     ///
-    pure int fpclassify(double x)    { return __fpclassify_d(x); }
+    extern(C) pragma(mangle, "__fpclassify_d") pure int fpclassify(double x);
     ///
-    pure int fpclassify(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __fpclassify_d(x)
-            : __fpclassify_ld(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify_d" : "__fpclassify_ld")
+    pure int fpclassify(real x);
 
     //int isfinite(real-floating x);
     ///
@@ -442,24 +438,18 @@  else version (CRuntime_Microsoft) // fully supported since MSVCRT 12 (VS 2013) o
         FP_NAN       =  2,
     }
 
-    pure private short _fdclass(float x);
-    pure private short _dclass(double x);
-
-    pure private int _fdsign(float x);
-    pure private int _dsign(double x);
-
   extern(D)
   {
     //int fpclassify(real-floating x);
     ///
-    pure int fpclassify()(float x)   { return _fdclass(x); }
+    extern(C) pragma(mangle, "_fdclass") pure int fpclassify(float x);
     ///
-    pure int fpclassify()(double x)  { return _dclass(x);  }
+    extern(C) pragma(mangle, "_dclass")  pure int fpclassify(double x);
     ///
     pure int fpclassify()(real x)
     {
         static if (real.sizeof == double.sizeof)
-            return _dclass(cast(double) x);
+            return fpclassify(cast(double) x);
         else
             static assert(false, "fpclassify(real) not supported by MS C runtime");
     }
@@ -495,7 +485,7 @@  else version (CRuntime_Microsoft) // fully supported since MSVCRT 12 (VS 2013) o
         ///
         pure int isnan(float x)      { version (Win64) return _isnanf(x); else return _isnan(cast(double) x); }
         ///
-        pure int isnan(double x)     { return _isnan(x); }
+        extern(C) pragma(mangle, "_isnan") pure int isnan(double x);
         ///
         pure int isnan(real x)       { return _isnan(cast(double) x); }
     }
@@ -510,14 +500,14 @@  else version (CRuntime_Microsoft) // fully supported since MSVCRT 12 (VS 2013) o
 
     //int signbit(real-floating x);
     ///
-    pure int signbit()(float x)   { return _fdsign(x); }
+    extern(C) pragma(mangle, "_fdsign") pure int signbit(float x);
     ///
-    pure int signbit()(double x)  { return _dsign(x);  }
+    extern(C) pragma(mangle, "_dsign")  pure int signbit(double x);
     ///
     pure int signbit()(real x)
     {
         static if (real.sizeof == double.sizeof)
-            return _dsign(cast(double) x);
+            return signbit(cast(double) x);
         else
             return (cast(short*)&(x))[4] & 0x8000;
     }
@@ -573,55 +563,39 @@  else version (CRuntime_Glibc)
   {
     //int fpclassify(real-floating x);
       ///
-    pure int fpclassify(float x)     { return __fpclassifyf(x); }
+    extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
     ///
-    pure int fpclassify(double x)    { return __fpclassify(x);  }
+    extern(C) pragma(mangle, "__fpclassify")  pure int fpclassify(double x);
     ///
-    pure int fpclassify(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __fpclassify(x)
-            : __fpclassifyl(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl")
+    pure int fpclassify(real x);
 
     //int isfinite(real-floating x);
     ///
-    pure int isfinite(float x)       { return __finitef(x); }
+    extern(C) pragma(mangle, "__finitef") pure int isfinite(float x);
     ///
-    pure int isfinite(double x)      { return __finite(x);  }
+    extern(C) pragma(mangle, "__finite")  pure int isfinite(double x);
     ///
-    pure int isfinite(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __finite(x)
-            : __finitel(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__finite" : "__finitel")
+    pure int isfinite(real x);
 
     //int isinf(real-floating x);
     ///
-    pure int isinf(float x)          { return __isinff(x);  }
+    extern(C) pragma(mangle, "__isinff") pure int isinf(float x);
     ///
-    pure int isinf(double x)         { return __isinf(x);   }
+    extern(C) pragma(mangle, "__isinf")  pure int isinf(double x);
     ///
-    pure int isinf(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __isinf(x)
-            : __isinfl(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isinf" : "__isinfl")
+    pure int isinf(real x);
 
     //int isnan(real-floating x);
     ///
-    pure int isnan(float x)          { return __isnanf(x);  }
+    extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
     ///
-    pure int isnan(double x)         { return __isnan(x);   }
+    extern(C) pragma(mangle, "__isnan")  pure int isnan(double x);
     ///
-    pure int isnan(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __isnan(x)
-            : __isnanl(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl")
+    pure int isnan(real x);
 
     //int isnormal(real-floating x);
     ///
@@ -633,16 +607,12 @@  else version (CRuntime_Glibc)
 
     //int signbit(real-floating x);
     ///
-    pure int signbit(float x)     { return __signbitf(x); }
+    extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
     ///
-    pure int signbit(double x)    { return __signbit(x);  }
+    extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
     ///
-    pure int signbit(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __signbit(x)
-            : __signbitl(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl")
+    pure int signbit(real x);
   }
 }
 else version (CRuntime_Musl)
@@ -685,16 +655,12 @@  else version (CRuntime_Musl)
   {
     //int fpclassify(real-floating x);
       ///
-    int fpclassify(float x)     { return __fpclassifyf(x); }
+    extern(C) pragma(mangle, "__fpclassifyf") int fpclassify(float x);
     ///
-    int fpclassify(double x)    { return __fpclassify(x);  }
+    extern(C) pragma(mangle, "__fpclassify")  int fpclassify(double x);
     ///
-    int fpclassify(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __fpclassify(x)
-            : __fpclassifyl(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl")
+    int fpclassify(real x);
     private uint __FLOAT_BITS(float __f)
     {
         union __u_t {
@@ -765,16 +731,12 @@  else version (CRuntime_Musl)
 
     //int signbit(real-floating x);
     ///
-    int signbit(float x)     { return __signbitf(x); }
+    extern(C) pragma(mangle, "__signbitf") int signbit(float x);
     ///
-    int signbit(double x)    { return __signbit(x);  }
+    extern(C) pragma(mangle, "__signbit")  int signbit(double x);
     ///
-    int signbit(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __signbit(x)
-            : __signbitl(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl")
+    int signbit(real x);
   }
 }
 else version (CRuntime_UClibc)
@@ -826,52 +788,36 @@  else version (CRuntime_UClibc)
   extern (D)
   {
     ///
-    int fpclassify(float x)     { return __fpclassifyf(x); }
+    extern(C) pragma(mangle, "__fpclassifyf") int fpclassify(float x);
     ///
-    int fpclassify(double x)    { return __fpclassify(x);  }
+    extern(C) pragma(mangle, "__fpclassify")  int fpclassify(double x);
     ///
-    int fpclassify(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __fpclassify(x)
-            : __fpclassifyl(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl")
+    int fpclassify(real x);
 
     ///
-    int isfinite(float x)       { return __finitef(x); }
+    extern(C) pragma(mangle, "__finitef") int isfinite(float x);
     ///
-    int isfinite(double x)      { return __finite(x);  }
+    extern(C) pragma(mangle, "__finite")  int isfinite(double x);
     ///
-    int isfinite(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __finite(x)
-            : __finitel(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__finite" : "__finitel")
+    int isfinite(real x);
 
     ///
-    int isinf(float x)          { return __isinff(x);  }
+    extern(C) pragma(mangle, "__isinff") int isinf(float x);
     ///
-    int isinf(double x)         { return __isinf(x);   }
+    extern(C) pragma(mangle, "__isinf")  int isinf(double x);
     ///
-    int isinf(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __isinf(x)
-            : __isinfl(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isinf" : "__isinfl")
+    int isinf(real x);
 
     ///
-    int isnan(float x)          { return __isnanf(x);  }
+    extern(C) pragma(mangle, "__isnanf") int isnan(float x);
     ///
-    int isnan(double x)         { return __isnan(x);   }
+    extern(C) pragma(mangle, "__isnan")  int isnan(double x);
     ///
-    int isnan(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __isnan(x)
-            : __isnanl(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl")
+    int isnan(real x);
 
     ///
     int isnormal(float x)       { return fpclassify(x) == FP_NORMAL; }
@@ -881,16 +827,12 @@  else version (CRuntime_UClibc)
     int isnormal(real x)        { return fpclassify(x) == FP_NORMAL; }
 
     ///
-    int signbit(float x)     { return __signbitf(x); }
+    extern(C) pragma(mangle, "__signbitf") int signbit(float x);
     ///
-    int signbit(double x)    { return __signbit(x);  }
+    extern(C) pragma(mangle, "__signbit")  int signbit(double x);
     ///
-    int signbit(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __signbit(x)
-            : __signbitl(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl")
+    int signbit(real x);
   }
 }
 else version (MinGW)
@@ -925,16 +867,12 @@  else version (MinGW)
   {
     //int fpclassify(real-floating x);
       ///
-    pure int fpclassify(float x)     { return __fpclassifyf(x); }
+    extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
     ///
-    pure int fpclassify(double x)    { return __fpclassify(x);  }
+    extern(C) pragma(mangle, "__fpclassify")  pure int fpclassify(double x);
     ///
-    pure int fpclassify(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __fpclassify(x)
-            : __fpclassifyl(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl")
+    pure int fpclassify(real x);
 
     //int isfinite(real-floating x);
     ///
@@ -954,16 +892,12 @@  else version (MinGW)
 
     //int isnan(real-floating x);
     ///
-    pure int isnan(float x)          { return __isnanf(x);  }
+    extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
     ///
-    pure int isnan(double x)         { return __isnan(x);   }
+    extern(C) pragma(mangle, "__isnan")  pure int isnan(double x);
     ///
-    pure int isnan(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __isnan(x)
-            : __isnanl(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl")
+    pure int isnan(real x);
 
     //int isnormal(real-floating x);
     ///
@@ -975,16 +909,12 @@  else version (MinGW)
 
     //int signbit(real-floating x);
     ///
-    int signbit(float x)     { return __signbitf(x); }
+    extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
     ///
-    int signbit(double x)    { return __signbit(x);  }
+    extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
     ///
-    int signbit(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __signbit(x)
-            : __signbitl(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl")
+    int signbit(real x);
   }
 }
 else version (Darwin)
@@ -1070,35 +1000,35 @@  else version (Darwin)
   {
     //int fpclassify(real-floating x);
     ///
-    pure int fpclassify(float x)     { return __fpclassifyf(x); }
+    extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
     ///
-    pure int fpclassify(double x)    { return __fpclassifyd(x); }
+    extern(C) pragma(mangle, "__fpclassifyd") pure int fpclassify(double x);
     ///
-    pure int fpclassify(real x)      { return __fpclassifyl(x); }
+    extern(C) pragma(mangle, __fpclassifyl.mangleof) pure int fpclassify(real x);
 
     //int isfinite(real-floating x);
     ///
-    pure int isfinite(float x)       { return __isfinitef(x); }
+    extern(C) pragma(mangle, "__isfinitef") pure int isfinite(float x);
     ///
-    pure int isfinite(double x)      { return __isfinited(x); }
+    extern(C) pragma(mangle, "__isfinited") pure int isfinite(double x);
     ///
-    pure int isfinite(real x)        { return __isfinitel(x); }
+    extern(C) pragma(mangle, __isfinitel.mangleof) pure int isfinite(real x);
 
     //int isinf(real-floating x);
     ///
-    pure int isinf(float x)          { return __isinff(x); }
+    extern(C) pragma(mangle, "__isinff") pure int isinf(float x);
     ///
-    pure int isinf(double x)         { return __isinfd(x); }
+    extern(C) pragma(mangle, "__isinfd") pure int isinf(double x);
     ///
-    pure int isinf(real x)           { return __isinfl(x); }
+    extern(C) pragma(mangle, __isinfl.mangleof) pure int isinf(real x);
 
     //int isnan(real-floating x);
     ///
-    pure int isnan(float x)          { return __isnanf(x); }
+    extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
     ///
-    pure int isnan(double x)         { return __isnand(x); }
+    extern(C) pragma(mangle, "__isnand") pure int isnan(double x);
     ///
-    pure int isnan(real x)           { return __isnanl(x); }
+    extern(C) pragma(mangle, __isnanl.mangleof) pure int isnan(real x);
 
     //int isnormal(real-floating x);
     ///
@@ -1110,11 +1040,11 @@  else version (Darwin)
 
     //int signbit(real-floating x);
     ///
-    pure int signbit(float x)     { return __signbitf(x); }
+    extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
     ///
-    pure int signbit(double x)    { return __signbitd(x); }
+    extern(C) pragma(mangle, "__signbitd") pure int signbit(double x);
     ///
-    pure int signbit(real x)      { return __signbitl(x); }
+    extern(C) pragma(mangle, "__signbitl") pure int signbit(real x);
   }
 }
 else version (FreeBSD)
@@ -1163,27 +1093,27 @@  else version (FreeBSD)
   {
     //int fpclassify(real-floating x);
       ///
-    pure int fpclassify(float x)     { return __fpclassifyf(x); }
+    extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
     ///
-    pure int fpclassify(double x)    { return __fpclassifyd(x); }
+    extern(C) pragma(mangle, "__fpclassifyd") pure int fpclassify(double x);
     ///
-    pure int fpclassify(real x)      { return __fpclassifyl(x); }
+    extern(C) pragma(mangle, "__fpclassifyl") pure int fpclassify(real x);
 
     //int isfinite(real-floating x);
     ///
-    pure int isfinite(float x)       { return __isfinitef(x); }
+    extern(C) pragma(mangle, "__isfinitef") pure int isfinite(float x);
     ///
-    pure int isfinite(double x)      { return __isfinite(x); }
+    extern(C) pragma(mangle, "__isfinite")  pure int isfinite(double x);
     ///
-    pure int isfinite(real x)        { return __isfinitel(x); }
+    extern(C) pragma(mangle, "__isfinitel") pure int isfinite(real x);
 
     //int isinf(real-floating x);
     ///
-    pure int isinf(float x)          { return __isinff(x); }
+    extern(C) pragma(mangle, "__isinff") pure int isinf(float x);
     ///
     pure int isinf(double x)         { return __isinfl(x); }
     ///
-    pure int isinf(real x)           { return __isinfl(x); }
+    extern(C) pragma(mangle, "__isinfl") pure int isinf(real x);
 
     //int isnan(real-floating x);
     ///
@@ -1191,21 +1121,21 @@  else version (FreeBSD)
     ///
     pure int isnan(double x)         { return __isnanl(x); }
     ///
-    pure int isnan(real x)           { return __isnanl(x); }
+    extern(C) pragma(mangle, "__isnanl") pure int isnan(real x);
 
     //int isnormal(real-floating x);
     ///
-    pure int isnormal(float x)       { return __isnormalf(x); }
+    extern(C) pragma(mangle, "__isnormalf") pure int isnormal(float x);
     ///
-    pure int isnormal(double x)      { return __isnormal(x); }
+    extern(C) pragma(mangle, "__isnormal")  pure int isnormal(double x);
     ///
-    pure int isnormal(real x)        { return __isnormall(x); }
+    extern(C) pragma(mangle, "__isnormall") pure int isnormal(real x);
 
     //int signbit(real-floating x);
     ///
-    pure int signbit(float x)        { return __signbitf(x); }
+    extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
     ///
-    pure int signbit(double x)       { return __signbit(x); }
+    extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
     ///
     pure int signbit(real x)         { return __signbit(x); }
   }
@@ -1256,27 +1186,27 @@  else version (OpenBSD)
   {
     //int fpclassify(real-floating x);
       ///
-    pure int fpclassify(float x)     { return __fpclassifyf(x); }
+    extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
     ///
-    pure int fpclassify(double x)    { return __fpclassifyd(x); }
+    extern(C) pragma(mangle, "__fpclassifyd") pure int fpclassify(double x);
     ///
-    pure int fpclassify(real x)      { return __fpclassifyl(x); }
+    extern(C) pragma(mangle, "__fpclassifyl") pure int fpclassify(real x);
 
     //int isfinite(real-floating x);
     ///
-    pure int isfinite(float x)       { return __isfinitef(x); }
+    extern(C) pragma(mangle, "__isfinitef") pure int isfinite(float x);
     ///
-    pure int isfinite(double x)      { return __isfinite(x); }
+    extern(C) pragma(mangle, "__isfinite")  pure int isfinite(double x);
     ///
-    pure int isfinite(real x)        { return __isfinitel(x); }
+    extern(C) pragma(mangle, "__isfinitel") pure int isfinite(real x);
 
     //int isinf(real-floating x);
     ///
-    pure int isinf(float x)          { return __isinff(x); }
+    extern(C) pragma(mangle, "__isinff") pure int isinf(float x);
     ///
     pure int isinf(double x)         { return __isinfl(x); }
     ///
-    pure int isinf(real x)           { return __isinfl(x); }
+    extern(C) pragma(mangle, "__isinfl") pure int isinf(real x);
 
     //int isnan(real-floating x);
     ///
@@ -1284,21 +1214,21 @@  else version (OpenBSD)
     ///
     pure int isnan(double x)         { return __isnanl(x); }
     ///
-    pure int isnan(real x)           { return __isnanl(x); }
+    extern(C) pragma(mangle, "__isnanl") pure int isnan(real x);
 
     //int isnormal(real-floating x);
     ///
-    pure int isnormal(float x)       { return __isnormalf(x); }
+    extern(C) pragma(mangle, "__isnormalf") pure int isnormal(float x);
     ///
-    pure int isnormal(double x)      { return __isnormal(x); }
+    extern(C) pragma(mangle, "__isnormal")  pure int isnormal(double x);
     ///
-    pure int isnormal(real x)        { return __isnormall(x); }
+    extern(C) pragma(mangle, "__isnormall") pure int isnormal(real x);
 
     //int signbit(real-floating x);
     ///
-    pure int signbit(float x)        { return __signbitf(x); }
+    extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
     ///
-    pure int signbit(double x)       { return __signbit(x); }
+    extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
     ///
     pure int signbit(real x)         { return __signbit(x); }
   }
@@ -1337,16 +1267,12 @@  else version (NetBSD)
   {
     //int fpclassify(real-floating x);
     ///
-    pure int fpclassify(float x)     { return __fpclassifyf(x); }
+    extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
     ///
-    pure int fpclassify(double x)    { return __fpclassifyd(x); }
+    extern(C) pragma(mangle, "__fpclassifyd") pure int fpclassify(double x);
     ///
-    pure int fpclassify(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __fpclassifyd(x)
-            : __fpclassifyl(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassifyd" : "__fpclassifyl")
+    pure int fpclassify(real x);
 
     //int isfinite(real-floating x);
     ///
@@ -1433,29 +1359,29 @@  else version (DragonFlyBSD)
 
   extern (D)
   {
-    pure int fpclassify(float x)     { return __fpclassifyf(x); }
-    pure int fpclassify(double x)    { return __fpclassifyd(x); }
-    pure int fpclassify(real x)      { return __fpclassifyl(x); }
+    extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
+    extern(C) pragma(mangle, "__fpclassifyd") pure int fpclassify(double x);
+    extern(C) pragma(mangle, "__fpclassifyl") pure int fpclassify(real x);
 
-    pure int isfinite(float x)       { return __isfinitef(x); }
-    pure int isfinite(double x)      { return __isfinite(x); }
-    pure int isfinite(real x)        { return __isfinitel(x); }
+    extern(C) pragma(mangle, "__isfinitef") pure int isfinite(float x);
+    extern(C) pragma(mangle, "__isfinite")  pure int isfinite(double x);
+    extern(C) pragma(mangle, "__isfinitel") pure int isfinite(real x);
 
-    pure int isinf(float x)          { return __isinff(x); }
-    pure int isinf(double x)         { return __isinf(x); }
-    pure int isinf(real x)           { return __isinfl(x); }
+    extern(C) pragma(mangle, "__isinff") pure int isinf(float x);
+    extern(C) pragma(mangle, "__isinf")  pure int isinf(double x);
+    extern(C) pragma(mangle, "__isinfl") pure int isinf(real x);
 
-    pure int isnan(float x)          { return __isnanf(x); }
-    pure int isnan(double x)         { return __isnan(x); }
-    pure int isnan(real x)           { return __isnanl(x); }
+    extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
+    extern(C) pragma(mangle, "__isnan")  pure int isnan(double x);
+    extern(C) pragma(mangle, "__isnanl") pure int isnan(real x);
 
-    pure int isnormal(float x)       { return __isnormalf(x); }
-    pure int isnormal(double x)      { return __isnormal(x); }
-    pure int isnormal(real x)        { return __isnormall(x); }
+    extern(C) pragma(mangle, "__isnormalf") pure int isnormal(float x);
+    extern(C) pragma(mangle, "__isnormal")  pure int isnormal(double x);
+    extern(C) pragma(mangle, "__isnormall") pure int isnormal(real x);
 
-    pure int signbit(float x)        { return __signbitf(x); }
-    pure int signbit(double x)       { return __signbit(x); }
-    pure int signbit(real x)         { return __signbitl(x); }
+    extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
+    extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
+    extern(C) pragma(mangle, "__signbitl") pure int signbit(real x);
   }
 }
 else version (Solaris)
@@ -1468,16 +1394,12 @@  else version (Solaris)
   {
     //int isnan(real-floating x);
       ///
-    pure int isnan(float x)          { return __isnanf(x);  }
+    extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
     ///
-    pure int isnan(double x)         { return __isnan(x);   }
+    extern(C) pragma(mangle, "__isnan")  pure int isnan(double x);
     ///
-    pure int isnan(real x)
-    {
-        return (real.sizeof == double.sizeof)
-            ? __isnan(x)
-            : __isnanl(x);
-    }
+    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl")
+    pure int isnan(real x);
   }
 }
 else version (CRuntime_Bionic)
@@ -1527,49 +1449,49 @@  else version (CRuntime_Bionic)
   {
     //int fpclassify(real-floating x);
       ///
-    pure int fpclassify(float x)     { return __fpclassifyf(x); }
+    extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
     ///
-    pure int fpclassify(double x)    { return __fpclassifyd(x); }
+    extern(C) pragma(mangle, "__fpclassifyd") pure int fpclassify(double x);
     ///
-    pure int fpclassify(real x)      { return __fpclassifyl(x); }
+    extern(C) pragma(mangle, "__fpclassifyl") pure int fpclassify(real x);
 
     //int isfinite(real-floating x);
     ///
-    pure int isfinite(float x)       { return __isfinitef(x); }
+    extern(C) pragma(mangle, "__isfinitef") pure int isfinite(float x);
     ///
-    pure int isfinite(double x)      { return __isfinite(x); }
+    extern(C) pragma(mangle, "__isfinite")  pure int isfinite(double x);
     ///
-    pure int isfinite(real x)        { return __isfinitel(x); }
+    extern(C) pragma(mangle, "__isfinitel") pure int isfinite(real x);
 
     //int isinf(real-floating x);
     ///
-    pure int isinf(float x)          { return __isinff(x); }
+    extern(C) pragma(mangle, "__isinff") pure int isinf(float x);
     ///
-    pure int isinf(double x)         { return __isinf(x); }
+    extern(C) pragma(mangle, "__isinf")  pure int isinf(double x);
     ///
-    pure int isinf(real x)           { return __isinfl(x); }
+    extern(C) pragma(mangle, "__isinfl") pure int isinf(real x);
 
     //int isnan(real-floating x);
     ///
-    pure int isnan(float x)          { return isnanf(x); }
+    extern(C) pragma(mangle, "isnanf")   pure int isnan(float x);
     ///
-    pure int isnan(real x)           { return __isnanl(x); }
+    extern(C) pragma(mangle, "__isnanl") pure int isnan(real x);
 
     //int isnormal(real-floating x);
     ///
-    pure int isnormal(float x)       { return __isnormalf(x); }
+    extern(C) pragma(mangle, "__isnormalf") pure int isnormal(float x);
     ///
-    pure int isnormal(double x)      { return __isnormal(x); }
+    extern(C) pragma(mangle, "__isnormal")  pure int isnormal(double x);
     ///
-    pure int isnormal(real x)        { return __isnormall(x); }
+    extern(C) pragma(mangle, "__isnormall") pure int isnormal(real x);
 
     //int signbit(real-floating x);
     ///
-    pure int signbit(float x)        { return __signbitf(x); }
+    extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
     ///
-    pure int signbit(double x)       { return __signbit(x); }
+    extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
     ///
-    pure int signbit(real x)         { return __signbitl(x); }
+    extern(C) pragma(mangle, "__signbitl") pure int signbit(real x);
   }
 }
 
@@ -1841,14 +1763,12 @@  version (CRuntime_Microsoft) // fully supported since MSVCRT 12 (VS 2013) only
     ///
     extern(D) pure real  fabsl()(real x)  { return fabs(cast(double) x); }
 
-    private double _hypot(double x, double y);
-    private float  _hypotf(float x, float y);
     ///
-    extern(D) double hypot(double x, double y) { return _hypot(x, y); }
+    extern(C) pragma(mangle, "_hypot")  double hypot(double x, double y);
     ///
-    extern(D) float  hypotf(float x, float y)  { return _hypotf(x, y); }
+    extern(C) pragma(mangle, "_hypotf") float  hypotf(float x, float y);
     ///
-    extern(D) real   hypotl(real x, real y)    { return _hypot(cast(double) x, cast(double) y); }
+    extern(D) real   hypotl(real x, real y)    { return hypot(cast(double) x, cast(double) y); }
 
     ///
     double  pow(double x, double y);
diff --git a/libphobos/libdruntime/core/stdc/stdio.d b/libphobos/libdruntime/core/stdc/stdio.d
index 67011596b1c..532a0803f55 100644
--- a/libphobos/libdruntime/core/stdc/stdio.d
+++ b/libphobos/libdruntime/core/stdc/stdio.d
@@ -1166,61 +1166,73 @@  version (MinGW)
     // Prefer the MinGW versions over the MSVC ones, as the latter don't handle
     // reals at all.
     ///
+    pragma(printf)
     int __mingw_fprintf(FILE* stream, scope const char* format, scope const ...);
     ///
     alias __mingw_fprintf fprintf;
 
     ///
+    pragma(scanf)
     int __mingw_fscanf(FILE* stream, scope const char* format, scope ...);
     ///
     alias __mingw_fscanf fscanf;
 
     ///
+    pragma(printf)
     int __mingw_sprintf(scope char* s, scope const char* format, scope const ...);
     ///
     alias __mingw_sprintf sprintf;
 
     ///
+    pragma(scanf)
     int __mingw_sscanf(scope const char* s, scope const char* format, scope ...);
     ///
     alias __mingw_sscanf sscanf;
 
     ///
+    pragma(printf)
     int __mingw_vfprintf(FILE* stream, scope const char* format, va_list arg);
     ///
     alias __mingw_vfprintf vfprintf;
 
     ///
+    pragma(scanf)
     int __mingw_vfscanf(FILE* stream, scope const char* format, va_list arg);
     ///
     alias __mingw_vfscanf vfscanf;
 
     ///
+    pragma(printf)
     int __mingw_vsprintf(scope char* s, scope const char* format, va_list arg);
     ///
     alias __mingw_vsprintf vsprintf;
 
     ///
+    pragma(scanf)
     int __mingw_vsscanf(scope const char* s, scope const char* format, va_list arg);
     ///
     alias __mingw_vsscanf vsscanf;
 
     ///
+    pragma(printf)
     int __mingw_vprintf(scope const char* format, va_list arg);
     ///
     alias __mingw_vprintf vprintf;
 
     ///
+    pragma(scanf)
     int __mingw_vscanf(scope const char* format, va_list arg);
     ///
     alias __mingw_vscanf vscanf;
 
     ///
+    pragma(printf)
     int __mingw_printf(scope const char* format, scope const ...);
     ///
     alias __mingw_printf printf;
 
     ///
+    pragma(scanf)
     int __mingw_scanf(scope const char* format, scope ...);
     ///
     alias __mingw_scanf scanf;
@@ -1228,28 +1240,40 @@  version (MinGW)
 else
 {
     ///
+    pragma(printf)
     int fprintf(FILE* stream, scope const char* format, scope const ...);
     ///
+    pragma(scanf)
     int fscanf(FILE* stream, scope const char* format, scope ...);
     ///
+    pragma(printf)
     int sprintf(scope char* s, scope const char* format, scope const ...);
     ///
+    pragma(scanf)
     int sscanf(scope const char* s, scope const char* format, scope ...);
     ///
+    pragma(printf)
     int vfprintf(FILE* stream, scope const char* format, va_list arg);
     ///
+    pragma(scanf)
     int vfscanf(FILE* stream, scope const char* format, va_list arg);
     ///
+    pragma(printf)
     int vsprintf(scope char* s, scope const char* format, va_list arg);
     ///
+    pragma(scanf)
     int vsscanf(scope const char* s, scope const char* format, va_list arg);
     ///
+    pragma(printf)
     int vprintf(scope const char* format, va_list arg);
     ///
+    pragma(scanf)
     int vscanf(scope const char* format, va_list arg);
     ///
+    pragma(printf)
     int printf(scope const char* format, scope const ...);
     ///
+    pragma(scanf)
     int scanf(scope const char* format, scope ...);
 }
 
@@ -1278,12 +1302,13 @@  extern (D) @trusted
     int getchar()()                 { return getc(stdin);     }
     ///
     int putchar()(int c)            { return putc(c,stdout);  }
-    ///
-    int getc()(FILE* stream)        { return fgetc(stream);   }
-    ///
-    int putc()(int c, FILE* stream) { return fputc(c,stream); }
 }
 
+///
+alias getc = fgetc;
+///
+alias putc = fputc;
+
 ///
 @trusted int ungetc(int c, FILE* stream); // No unsafe pointer manipulation.
 
@@ -1323,11 +1348,13 @@  version (CRuntime_DigitalMars)
     pure int  fileno()(FILE* stream)   { return stream._file; }
   }
   ///
+    pragma(printf)
     int   _snprintf(scope char* s, size_t n, scope const char* fmt, scope const ...);
     ///
     alias _snprintf snprintf;
 
     ///
+    pragma(printf)
     int   _vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
     ///
     alias _vsnprintf vsnprintf;
@@ -1351,6 +1378,7 @@  else version (CRuntime_Microsoft)
 
   version (MinGW)
   {
+    pragma(printf)
     int   __mingw_snprintf(scope char* s, size_t n, scope const char* fmt, scope const ...);
     ///
     alias __mingw_snprintf _snprintf;
@@ -1358,6 +1386,7 @@  else version (CRuntime_Microsoft)
     alias __mingw_snprintf snprintf;
 
     ///
+    pragma(printf)
     int   __mingw_vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
     ///
     alias __mingw_vsnprintf _vsnprintf;
@@ -1367,13 +1396,17 @@  else version (CRuntime_Microsoft)
   else
   {
     ///
+    pragma(printf)
     int _snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
     ///
+    pragma(printf)
     int  snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
 
     ///
+    pragma(printf)
     int _vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
     ///
+    pragma(printf)
     int  vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
   }
 
@@ -1410,8 +1443,10 @@  else version (CRuntime_Glibc)
   }
 
     ///
+    pragma(printf)
     int  snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
     ///
+    pragma(printf)
     int  vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
 }
 else version (Darwin)
@@ -1432,8 +1467,10 @@  else version (Darwin)
   }
 
     ///
+    pragma(printf)
     int  snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
     ///
+    pragma(printf)
     int  vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
 }
 else version (FreeBSD)
@@ -1454,8 +1491,10 @@  else version (FreeBSD)
   }
 
     ///
+    pragma(printf)
     int  snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
     ///
+    pragma(printf)
     int  vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
 }
 else version (NetBSD)
@@ -1476,8 +1515,10 @@  else version (NetBSD)
   }
 
     ///
+    pragma(printf)
     int  snprintf(char* s, size_t n, const scope char* format, scope const ...);
     ///
+    pragma(printf)
     int  vsnprintf(char* s, size_t n, const scope char* format, va_list arg);
 }
 else version (OpenBSD)
@@ -1567,8 +1608,10 @@  else version (OpenBSD)
     }
 
     ///
+    pragma(printf)
     int  snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
     ///
+    pragma(printf)
     int  vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
 }
 else version (DragonFlyBSD)
@@ -1599,7 +1642,9 @@  else version (DragonFlyBSD)
   enum __SALC = 0x4000;
   enum __SIGN = 0x8000;
 
+    pragma(printf)
     int  snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
+    pragma(printf)
     int  vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
 }
 else version (Solaris)
@@ -1620,8 +1665,10 @@  else version (Solaris)
   }
 
     ///
+    pragma(printf)
     int  snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
     ///
+    pragma(printf)
     int  vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
 }
 else version (CRuntime_Bionic)
@@ -1642,8 +1689,10 @@  else version (CRuntime_Bionic)
   }
 
     ///
+    pragma(printf)
     int  snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
     ///
+    pragma(printf)
     int  vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
 }
 else version (CRuntime_Musl)
@@ -1663,8 +1712,10 @@  else version (CRuntime_Musl)
     }
 
     ///
+    pragma(printf)
     int snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
     ///
+    pragma(printf)
     int vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
 }
 else version (CRuntime_UClibc)
@@ -1685,8 +1736,10 @@  else version (CRuntime_UClibc)
   }
 
     ///
+    pragma(printf)
     int  snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
     ///
+    pragma(printf)
     int  vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
 }
 else
diff --git a/libphobos/libdruntime/core/stdc/stdlib.d b/libphobos/libdruntime/core/stdc/stdlib.d
index 7caef4c1339..5d69b880bc8 100644
--- a/libphobos/libdruntime/core/stdc/stdlib.d
+++ b/libphobos/libdruntime/core/stdc/stdlib.d
@@ -164,13 +164,13 @@  void*   realloc(void* ptr, size_t size);
 void    free(void* ptr);
 
 ///
-void    abort() @safe;
+noreturn abort() @safe;
 ///
-void    exit(int status);
+noreturn exit(int status);
 ///
 int     atexit(void function() func);
 ///
-void    _Exit(int status);
+noreturn _Exit(int status);
 
 ///
 char*   getenv(scope const char* name);
diff --git a/libphobos/libdruntime/core/stdc/tgmath.d b/libphobos/libdruntime/core/stdc/tgmath.d
index 4dd1b3ccc66..2ff1522fd81 100644
--- a/libphobos/libdruntime/core/stdc/tgmath.d
+++ b/libphobos/libdruntime/core/stdc/tgmath.d
@@ -32,12 +32,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.acosl         acos;
 
-    ///
-    alias core.stdc.complex.cacos      acos;
-    ///
-    alias core.stdc.complex.cacosf     acos;
-    ///
-    alias core.stdc.complex.cacosl     acos;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.cacos      acos;
+    deprecated alias core.stdc.complex.cacosf     acos;
+    deprecated alias core.stdc.complex.cacosl     acos;
 
     ///
     alias core.stdc.math.asin          asin;
@@ -46,12 +44,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.asinl         asin;
 
-    ///
-    alias core.stdc.complex.casin      asin;
-    ///
-    alias core.stdc.complex.casinf     asin;
-    ///
-    alias core.stdc.complex.casinl     asin;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.casin      asin;
+    deprecated alias core.stdc.complex.casinf     asin;
+    deprecated alias core.stdc.complex.casinl     asin;
 
     ///
     alias core.stdc.math.atan          atan;
@@ -60,12 +56,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.atanl         atan;
 
-    ///
-    alias core.stdc.complex.catan      atan;
-    ///
-    alias core.stdc.complex.catanf     atan;
-    ///
-    alias core.stdc.complex.catanl     atan;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.catan      atan;
+    deprecated alias core.stdc.complex.catanf     atan;
+    deprecated alias core.stdc.complex.catanl     atan;
 
     ///
     alias core.stdc.math.atan2         atan2;
@@ -81,12 +75,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.cosl          cos;
 
-    ///
-    alias core.stdc.complex.ccos       cos;
-    ///
-    alias core.stdc.complex.ccosf      cos;
-    ///
-    alias core.stdc.complex.ccosl      cos;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.ccos       cos;
+    deprecated alias core.stdc.complex.ccosf      cos;
+    deprecated alias core.stdc.complex.ccosl      cos;
 
     ///
     alias core.stdc.math.sin           sin;
@@ -95,12 +87,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.sinl          sin;
 
-    ///
-    alias core.stdc.complex.csin       csin;
-    ///
-    alias core.stdc.complex.csinf      csin;
-    ///
-    alias core.stdc.complex.csinl      csin;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.csin       csin;
+    deprecated alias core.stdc.complex.csinf      csin;
+    deprecated alias core.stdc.complex.csinl      csin;
 
     ///
     alias core.stdc.math.tan           tan;
@@ -109,12 +99,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.tanl          tan;
 
-    ///
-    alias core.stdc.complex.ctan       tan;
-    ///
-    alias core.stdc.complex.ctanf      tan;
-    ///
-    alias core.stdc.complex.ctanl      tan;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.ctan       tan;
+    deprecated alias core.stdc.complex.ctanf      tan;
+    deprecated alias core.stdc.complex.ctanl      tan;
 
     ///
     alias core.stdc.math.acosh         acosh;
@@ -123,12 +111,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.acoshl        acosh;
 
-    ///
-    alias core.stdc.complex.cacosh     acosh;
-    ///
-    alias core.stdc.complex.cacoshf    acosh;
-    ///
-    alias core.stdc.complex.cacoshl    acosh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.cacosh     acosh;
+    deprecated alias core.stdc.complex.cacoshf    acosh;
+    deprecated alias core.stdc.complex.cacoshl    acosh;
 
     ///
     alias core.stdc.math.asinh         asinh;
@@ -137,12 +123,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.asinhl        asinh;
 
-    ///
-    alias core.stdc.complex.casinh     asinh;
-    ///
-    alias core.stdc.complex.casinhf    asinh;
-    ///
-    alias core.stdc.complex.casinhl    asinh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.casinh     asinh;
+    deprecated alias core.stdc.complex.casinhf    asinh;
+    deprecated alias core.stdc.complex.casinhl    asinh;
 
     ///
     alias core.stdc.math.atanh         atanh;
@@ -151,12 +135,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.atanhl        atanh;
 
-    ///
-    alias core.stdc.complex.catanh     atanh;
-    ///
-    alias core.stdc.complex.catanhf    atanh;
-    ///
-    alias core.stdc.complex.catanhl    atanh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.catanh     atanh;
+    deprecated alias core.stdc.complex.catanhf    atanh;
+    deprecated alias core.stdc.complex.catanhl    atanh;
 
     ///
     alias core.stdc.math.cosh          cosh;
@@ -165,12 +147,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.coshl         cosh;
 
-    ///
-    alias core.stdc.complex.ccosh      cosh;
-    ///
-    alias core.stdc.complex.ccoshf     cosh;
-    ///
-    alias core.stdc.complex.ccoshl     cosh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.ccosh      cosh;
+    deprecated alias core.stdc.complex.ccoshf     cosh;
+    deprecated alias core.stdc.complex.ccoshl     cosh;
 
     ///
     alias core.stdc.math.sinh          sinh;
@@ -179,12 +159,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.sinhl         sinh;
 
-    ///
-    alias core.stdc.complex.csinh      sinh;
-    ///
-    alias core.stdc.complex.csinhf     sinh;
-    ///
-    alias core.stdc.complex.csinhl     sinh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.csinh      sinh;
+    deprecated alias core.stdc.complex.csinhf     sinh;
+    deprecated alias core.stdc.complex.csinhl     sinh;
 
     ///
     alias core.stdc.math.tanh          tanh;
@@ -193,12 +171,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.tanhl         tanh;
 
-    ///
-    alias core.stdc.complex.ctanh      tanh;
-    ///
-    alias core.stdc.complex.ctanhf     tanh;
-    ///
-    alias core.stdc.complex.ctanhl     tanh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.ctanh      tanh;
+    deprecated alias core.stdc.complex.ctanhf     tanh;
+    deprecated alias core.stdc.complex.ctanhl     tanh;
 
     ///
     alias core.stdc.math.exp           exp;
@@ -207,12 +183,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.expl          exp;
 
-    ///
-    alias core.stdc.complex.cexp       exp;
-    ///
-    alias core.stdc.complex.cexpf      exp;
-    ///
-    alias core.stdc.complex.cexpl      exp;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.cexp       exp;
+    deprecated alias core.stdc.complex.cexpf      exp;
+    deprecated alias core.stdc.complex.cexpl      exp;
 
     ///
     alias core.stdc.math.exp2          exp2;
@@ -256,12 +230,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.logl          log;
 
-    ///
-    alias core.stdc.complex.clog       log;
-    ///
-    alias core.stdc.complex.clogf      log;
-    ///
-    alias core.stdc.complex.clogl      log;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.clog       log;
+    deprecated alias core.stdc.complex.clogf      log;
+    deprecated alias core.stdc.complex.clogl      log;
 
     ///
     alias core.stdc.math.log10         log10;
@@ -325,12 +297,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.fabsl         fabs;
 
-    ///
-    alias core.stdc.complex.cabs       fabs;
-    ///
-    alias core.stdc.complex.cabsf      fabs;
-    ///
-    alias core.stdc.complex.cabsl      fabs;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.cabs       fabs;
+    deprecated alias core.stdc.complex.cabsf      fabs;
+    deprecated alias core.stdc.complex.cabsl      fabs;
 
     ///
     alias core.stdc.math.hypot         hypot;
@@ -346,12 +316,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.powl          pow;
 
-    ///
-    alias core.stdc.complex.cpow       pow;
-    ///
-    alias core.stdc.complex.cpowf      pow;
-    ///
-    alias core.stdc.complex.cpowl      pow;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.cpow       pow;
+    deprecated alias core.stdc.complex.cpowf      pow;
+    deprecated alias core.stdc.complex.cpowl      pow;
 
     ///
     alias core.stdc.math.sqrt          sqrt;
@@ -360,12 +328,10 @@  version (NetBSD)
     ///
     alias core.stdc.math.sqrtl         sqrt;
 
-    ///
-    alias core.stdc.complex.csqrt      sqrt;
-    ///
-    alias core.stdc.complex.csqrtf     sqrt;
-    ///
-    alias core.stdc.complex.csqrtl     sqrt;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.csqrt      sqrt;
+    deprecated alias core.stdc.complex.csqrtf     sqrt;
+    deprecated alias core.stdc.complex.csqrtl     sqrt;
 
     ///
     alias core.stdc.math.erf           erf;
@@ -539,37 +505,23 @@  version (NetBSD)
     ///
     alias core.stdc.math.fmal          fma;
 
-    ///
-    alias core.stdc.complex.carg       carg;
-    ///
-    alias core.stdc.complex.cargf      carg;
-    ///
-    alias core.stdc.complex.cargl      carg;
-
-    ///
-    alias core.stdc.complex.cimag      cimag;
-    ///
-    alias core.stdc.complex.cimagf     cimag;
-    ///
-    alias core.stdc.complex.cimagl     cimag;
-
-    ///
-    alias core.stdc.complex.conj       conj;
-    ///
-    alias core.stdc.complex.conjf      conj;
-    ///
-    alias core.stdc.complex.conjl      conj;
-
-    ///
-    alias core.stdc.complex.cproj      cproj;
-    ///
-    alias core.stdc.complex.cprojf     cproj;
-    ///
-    alias core.stdc.complex.cprojl     cproj;
-
-//  alias core.stdc.complex.creal      creal;
-//  alias core.stdc.complex.crealf     creal;
-//  alias core.stdc.complex.creall     creal;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.carg       carg;
+    deprecated alias core.stdc.complex.cargf      carg;
+    deprecated alias core.stdc.complex.cargl      carg;
+    deprecated alias core.stdc.complex.cimag      cimag;
+    deprecated alias core.stdc.complex.cimagf     cimag;
+    deprecated alias core.stdc.complex.cimagl     cimag;
+    deprecated alias core.stdc.complex.conj       conj;
+    deprecated alias core.stdc.complex.conjf      conj;
+    deprecated alias core.stdc.complex.conjl      conj;
+    deprecated alias core.stdc.complex.cproj      cproj;
+    deprecated alias core.stdc.complex.cprojf     cproj;
+    deprecated alias core.stdc.complex.cprojl     cproj;
+
+//  deprecated alias core.stdc.complex.creal      creal;
+//  deprecated alias core.stdc.complex.crealf     creal;
+//  deprecated alias core.stdc.complex.creall     creal;
 }
 else version (OpenBSD)
 {
@@ -580,12 +532,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.acosl         acos;
 
-    ///
-    alias core.stdc.complex.cacos      acos;
-    ///
-    alias core.stdc.complex.cacosf     acos;
-    ///
-    alias core.stdc.complex.cacosl     acos;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.cacos      acos;
+    deprecated alias core.stdc.complex.cacosf     acos;
+    deprecated alias core.stdc.complex.cacosl     acos;
 
     ///
     alias core.stdc.math.asin          asin;
@@ -594,12 +544,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.asinl         asin;
 
-    ///
-    alias core.stdc.complex.casin      asin;
-    ///
-    alias core.stdc.complex.casinf     asin;
-    ///
-    alias core.stdc.complex.casinl     asin;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.casin      asin;
+    deprecated alias core.stdc.complex.casinf     asin;
+    deprecated alias core.stdc.complex.casinl     asin;
 
     ///
     alias core.stdc.math.atan          atan;
@@ -608,12 +556,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.atanl         atan;
 
-    ///
-    alias core.stdc.complex.catan      atan;
-    ///
-    alias core.stdc.complex.catanf     atan;
-    ///
-    alias core.stdc.complex.catanl     atan;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.catan      atan;
+    deprecated alias core.stdc.complex.catanf     atan;
+    deprecated alias core.stdc.complex.catanl     atan;
 
     ///
     alias core.stdc.math.atan2         atan2;
@@ -629,12 +575,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.cosl          cos;
 
-    ///
-    alias core.stdc.complex.ccos       cos;
-    ///
-    alias core.stdc.complex.ccosf      cos;
-    ///
-    alias core.stdc.complex.ccosl      cos;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.ccos       cos;
+    deprecated alias core.stdc.complex.ccosf      cos;
+    deprecated alias core.stdc.complex.ccosl      cos;
 
     ///
     alias core.stdc.math.sin           sin;
@@ -643,12 +587,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.sinl          sin;
 
-    ///
-    alias core.stdc.complex.csin       csin;
-    ///
-    alias core.stdc.complex.csinf      csin;
-    ///
-    alias core.stdc.complex.csinl      csin;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.csin       csin;
+    deprecated alias core.stdc.complex.csinf      csin;
+    deprecated alias core.stdc.complex.csinl      csin;
 
     ///
     alias core.stdc.math.tan           tan;
@@ -657,12 +599,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.tanl          tan;
 
-    ///
-    alias core.stdc.complex.ctan       tan;
-    ///
-    alias core.stdc.complex.ctanf      tan;
-    ///
-    alias core.stdc.complex.ctanl      tan;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.ctan       tan;
+    deprecated alias core.stdc.complex.ctanf      tan;
+    deprecated alias core.stdc.complex.ctanl      tan;
 
     ///
     alias core.stdc.math.acosh         acosh;
@@ -671,12 +611,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.acoshl        acosh;
 
-    ///
-    alias core.stdc.complex.cacosh     acosh;
-    ///
-    alias core.stdc.complex.cacoshf    acosh;
-    ///
-    alias core.stdc.complex.cacoshl    acosh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.cacosh     acosh;
+    deprecated alias core.stdc.complex.cacoshf    acosh;
+    deprecated alias core.stdc.complex.cacoshl    acosh;
 
     ///
     alias core.stdc.math.asinh         asinh;
@@ -685,12 +623,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.asinhl        asinh;
 
-    ///
-    alias core.stdc.complex.casinh     asinh;
-    ///
-    alias core.stdc.complex.casinhf    asinh;
-    ///
-    alias core.stdc.complex.casinhl    asinh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.casinh     asinh;
+    deprecated alias core.stdc.complex.casinhf    asinh;
+    deprecated alias core.stdc.complex.casinhl    asinh;
 
     ///
     alias core.stdc.math.atanh         atanh;
@@ -699,12 +635,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.atanhl        atanh;
 
-    ///
-    alias core.stdc.complex.catanh     atanh;
-    ///
-    alias core.stdc.complex.catanhf    atanh;
-    ///
-    alias core.stdc.complex.catanhl    atanh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.catanh     atanh;
+    deprecated alias core.stdc.complex.catanhf    atanh;
+    deprecated alias core.stdc.complex.catanhl    atanh;
 
     ///
     alias core.stdc.math.cosh          cosh;
@@ -713,12 +647,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.coshl         cosh;
 
-    ///
-    alias core.stdc.complex.ccosh      cosh;
-    ///
-    alias core.stdc.complex.ccoshf     cosh;
-    ///
-    alias core.stdc.complex.ccoshl     cosh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.ccosh      cosh;
+    deprecated alias core.stdc.complex.ccoshf     cosh;
+    deprecated alias core.stdc.complex.ccoshl     cosh;
 
     ///
     alias core.stdc.math.sinh          sinh;
@@ -727,12 +659,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.sinhl         sinh;
 
-    ///
-    alias core.stdc.complex.csinh      sinh;
-    ///
-    alias core.stdc.complex.csinhf     sinh;
-    ///
-    alias core.stdc.complex.csinhl     sinh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.csinh      sinh;
+    deprecated alias core.stdc.complex.csinhf     sinh;
+    deprecated alias core.stdc.complex.csinhl     sinh;
 
     ///
     alias core.stdc.math.tanh          tanh;
@@ -741,12 +671,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.tanhl         tanh;
 
-    ///
-    alias core.stdc.complex.ctanh      tanh;
-    ///
-    alias core.stdc.complex.ctanhf     tanh;
-    ///
-    alias core.stdc.complex.ctanhl     tanh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.ctanh      tanh;
+    deprecated alias core.stdc.complex.ctanhf     tanh;
+    deprecated alias core.stdc.complex.ctanhl     tanh;
 
     ///
     alias core.stdc.math.exp           exp;
@@ -755,12 +683,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.expl          exp;
 
-    ///
-    alias core.stdc.complex.cexp       exp;
-    ///
-    alias core.stdc.complex.cexpf      exp;
-    ///
-    alias core.stdc.complex.cexpl      exp;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.cexp       exp;
+    deprecated alias core.stdc.complex.cexpf      exp;
+    deprecated alias core.stdc.complex.cexpl      exp;
 
     ///
     alias core.stdc.math.exp2          exp2;
@@ -804,12 +730,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.logl          log;
 
-    ///
-    alias core.stdc.complex.clog       log;
-    ///
-    alias core.stdc.complex.clogf      log;
-    ///
-    alias core.stdc.complex.clogl      log;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.clog       log;
+    deprecated alias core.stdc.complex.clogf      log;
+    deprecated alias core.stdc.complex.clogl      log;
 
     ///
     alias core.stdc.math.log10         log10;
@@ -874,12 +798,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.fabsl         fabs;
 
-    ///
-    alias core.stdc.complex.cabs       fabs;
-    ///
-    alias core.stdc.complex.cabsf      fabs;
-    ///
-    alias core.stdc.complex.cabsl      fabs;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.cabs       fabs;
+    deprecated alias core.stdc.complex.cabsf      fabs;
+    deprecated alias core.stdc.complex.cabsl      fabs;
 
     ///
     alias core.stdc.math.hypot         hypot;
@@ -895,12 +817,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.powl          pow;
 
-    ///
-    alias core.stdc.complex.cpow       pow;
-    ///
-    alias core.stdc.complex.cpowf      pow;
-    ///
-    alias core.stdc.complex.cpowl      pow;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.cpow       pow;
+    deprecated alias core.stdc.complex.cpowf      pow;
+    deprecated alias core.stdc.complex.cpowl      pow;
 
     ///
     alias core.stdc.math.sqrt          sqrt;
@@ -909,12 +829,10 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.sqrtl         sqrt;
 
-    ///
-    alias core.stdc.complex.csqrt      sqrt;
-    ///
-    alias core.stdc.complex.csqrtf     sqrt;
-    ///
-    alias core.stdc.complex.csqrtl     sqrt;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.csqrt      sqrt;
+    deprecated alias core.stdc.complex.csqrtf     sqrt;
+    deprecated alias core.stdc.complex.csqrtl     sqrt;
 
     ///
     alias core.stdc.math.erf           erf;
@@ -1077,37 +995,23 @@  else version (OpenBSD)
     ///
     alias core.stdc.math.fmal          fma;
 
-    ///
-    alias core.stdc.complex.carg       carg;
-    ///
-    alias core.stdc.complex.cargf      carg;
-    ///
-    alias core.stdc.complex.cargl      carg;
-
-    ///
-    alias core.stdc.complex.cimag      cimag;
-    ///
-    alias core.stdc.complex.cimagf     cimag;
-    ///
-    alias core.stdc.complex.cimagl     cimag;
-
-    ///
-    alias core.stdc.complex.conj       conj;
-    ///
-    alias core.stdc.complex.conjf      conj;
-    ///
-    alias core.stdc.complex.conjl      conj;
-
-    ///
-    alias core.stdc.complex.cproj      cproj;
-    ///
-    alias core.stdc.complex.cprojf     cproj;
-    ///
-    alias core.stdc.complex.cprojl     cproj;
-
-//  alias core.stdc.complex.creal      creal;
-//  alias core.stdc.complex.crealf     creal;
-//  alias core.stdc.complex.creall     creal;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.carg       carg;
+    deprecated alias core.stdc.complex.cargf      carg;
+    deprecated alias core.stdc.complex.cargl      carg;
+    deprecated alias core.stdc.complex.cimag      cimag;
+    deprecated alias core.stdc.complex.cimagf     cimag;
+    deprecated alias core.stdc.complex.cimagl     cimag;
+    deprecated alias core.stdc.complex.conj       conj;
+    deprecated alias core.stdc.complex.conjf      conj;
+    deprecated alias core.stdc.complex.conjl      conj;
+    deprecated alias core.stdc.complex.cproj      cproj;
+    deprecated alias core.stdc.complex.cprojf     cproj;
+    deprecated alias core.stdc.complex.cprojl     cproj;
+
+//  deprecated alias core.stdc.complex.creal      creal;
+//  deprecated alias core.stdc.complex.crealf     creal;
+//  deprecated alias core.stdc.complex.creall     creal;
 }
 else
 {
@@ -1118,12 +1022,10 @@  else
     ///
     alias core.stdc.math.acosl         acos;
 
-    ///
-    alias core.stdc.complex.cacos      acos;
-    ///
-    alias core.stdc.complex.cacosf     acos;
-    ///
-    alias core.stdc.complex.cacosl     acos;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.cacos      acos;
+    deprecated alias core.stdc.complex.cacosf     acos;
+    deprecated alias core.stdc.complex.cacosl     acos;
 
     ///
     alias core.stdc.math.asin          asin;
@@ -1132,12 +1034,10 @@  else
     ///
     alias core.stdc.math.asinl         asin;
 
-    ///
-    alias core.stdc.complex.casin      asin;
-    ///
-    alias core.stdc.complex.casinf     asin;
-    ///
-    alias core.stdc.complex.casinl     asin;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.casin      asin;
+    deprecated alias core.stdc.complex.casinf     asin;
+    deprecated alias core.stdc.complex.casinl     asin;
 
     ///
     alias core.stdc.math.atan          atan;
@@ -1146,12 +1046,10 @@  else
     ///
     alias core.stdc.math.atanl         atan;
 
-    ///
-    alias core.stdc.complex.catan      atan;
-    ///
-    alias core.stdc.complex.catanf     atan;
-    ///
-    alias core.stdc.complex.catanl     atan;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.catan      atan;
+    deprecated alias core.stdc.complex.catanf     atan;
+    deprecated alias core.stdc.complex.catanl     atan;
 
     ///
     alias core.stdc.math.atan2         atan2;
@@ -1167,12 +1065,10 @@  else
     ///
     alias core.stdc.math.cosl          cos;
 
-    ///
-    alias core.stdc.complex.ccos       cos;
-    ///
-    alias core.stdc.complex.ccosf      cos;
-    ///
-    alias core.stdc.complex.ccosl      cos;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.ccos       cos;
+    deprecated alias core.stdc.complex.ccosf      cos;
+    deprecated alias core.stdc.complex.ccosl      cos;
 
     ///
     alias core.stdc.math.sin           sin;
@@ -1181,12 +1077,10 @@  else
     ///
     alias core.stdc.math.sinl          sin;
 
-    ///
-    alias core.stdc.complex.csin       csin;
-    ///
-    alias core.stdc.complex.csinf      csin;
-    ///
-    alias core.stdc.complex.csinl      csin;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.csin       csin;
+    deprecated alias core.stdc.complex.csinf      csin;
+    deprecated alias core.stdc.complex.csinl      csin;
 
     ///
     alias core.stdc.math.tan           tan;
@@ -1195,12 +1089,10 @@  else
     ///
     alias core.stdc.math.tanl          tan;
 
-    ///
-    alias core.stdc.complex.ctan       tan;
-    ///
-    alias core.stdc.complex.ctanf      tan;
-    ///
-    alias core.stdc.complex.ctanl      tan;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.ctan       tan;
+    deprecated alias core.stdc.complex.ctanf      tan;
+    deprecated alias core.stdc.complex.ctanl      tan;
 
     ///
     alias core.stdc.math.acosh         acosh;
@@ -1209,12 +1101,10 @@  else
     ///
     alias core.stdc.math.acoshl        acosh;
 
-    ///
-    alias core.stdc.complex.cacosh     acosh;
-    ///
-    alias core.stdc.complex.cacoshf    acosh;
-    ///
-    alias core.stdc.complex.cacoshl    acosh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.cacosh     acosh;
+    deprecated alias core.stdc.complex.cacoshf    acosh;
+    deprecated alias core.stdc.complex.cacoshl    acosh;
 
     ///
     alias core.stdc.math.asinh         asinh;
@@ -1223,12 +1113,10 @@  else
     ///
     alias core.stdc.math.asinhl        asinh;
 
-    ///
-    alias core.stdc.complex.casinh     asinh;
-    ///
-    alias core.stdc.complex.casinhf    asinh;
-    ///
-    alias core.stdc.complex.casinhl    asinh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.casinh     asinh;
+    deprecated alias core.stdc.complex.casinhf    asinh;
+    deprecated alias core.stdc.complex.casinhl    asinh;
 
     ///
     alias core.stdc.math.atanh         atanh;
@@ -1237,12 +1125,10 @@  else
     ///
     alias core.stdc.math.atanhl        atanh;
 
-    ///
-    alias core.stdc.complex.catanh     atanh;
-    ///
-    alias core.stdc.complex.catanhf    atanh;
-    ///
-    alias core.stdc.complex.catanhl    atanh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.catanh     atanh;
+    deprecated alias core.stdc.complex.catanhf    atanh;
+    deprecated alias core.stdc.complex.catanhl    atanh;
 
     ///
     alias core.stdc.math.cosh          cosh;
@@ -1251,12 +1137,10 @@  else
     ///
     alias core.stdc.math.coshl         cosh;
 
-    ///
-    alias core.stdc.complex.ccosh      cosh;
-    ///
-    alias core.stdc.complex.ccoshf     cosh;
-    ///
-    alias core.stdc.complex.ccoshl     cosh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.ccosh      cosh;
+    deprecated alias core.stdc.complex.ccoshf     cosh;
+    deprecated alias core.stdc.complex.ccoshl     cosh;
 
     ///
     alias core.stdc.math.sinh          sinh;
@@ -1265,12 +1149,10 @@  else
     ///
     alias core.stdc.math.sinhl         sinh;
 
-    ///
-    alias core.stdc.complex.csinh      sinh;
-    ///
-    alias core.stdc.complex.csinhf     sinh;
-    ///
-    alias core.stdc.complex.csinhl     sinh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.csinh      sinh;
+    deprecated alias core.stdc.complex.csinhf     sinh;
+    deprecated alias core.stdc.complex.csinhl     sinh;
 
     ///
     alias core.stdc.math.tanh          tanh;
@@ -1279,12 +1161,10 @@  else
     ///
     alias core.stdc.math.tanhl         tanh;
 
-    ///
-    alias core.stdc.complex.ctanh      tanh;
-    ///
-    alias core.stdc.complex.ctanhf     tanh;
-    ///
-    alias core.stdc.complex.ctanhl     tanh;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.ctanh      tanh;
+    deprecated alias core.stdc.complex.ctanhf     tanh;
+    deprecated alias core.stdc.complex.ctanhl     tanh;
 
     ///
     alias core.stdc.math.exp           exp;
@@ -1293,12 +1173,10 @@  else
     ///
     alias core.stdc.math.expl          exp;
 
-    ///
-    alias core.stdc.complex.cexp       exp;
-    ///
-    alias core.stdc.complex.cexpf      exp;
-    ///
-    alias core.stdc.complex.cexpl      exp;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.cexp       exp;
+    deprecated alias core.stdc.complex.cexpf      exp;
+    deprecated alias core.stdc.complex.cexpl      exp;
 
     ///
     alias core.stdc.math.exp2          exp2;
@@ -1342,12 +1220,10 @@  else
     ///
     alias core.stdc.math.logl          log;
 
-    ///
-    alias core.stdc.complex.clog       log;
-    ///
-    alias core.stdc.complex.clogf      log;
-    ///
-    alias core.stdc.complex.clogl      log;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.clog       log;
+    deprecated alias core.stdc.complex.clogf      log;
+    deprecated alias core.stdc.complex.clogl      log;
 
     ///
     alias core.stdc.math.log10         log10;
@@ -1418,12 +1294,10 @@  else
         alias core.stdc.math.fabsl         fabs;
     }
 
-    ///
-    alias core.stdc.complex.cabs       fabs;
-    ///
-    alias core.stdc.complex.cabsf      fabs;
-    ///
-    alias core.stdc.complex.cabsl      fabs;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.cabs       fabs;
+    deprecated alias core.stdc.complex.cabsf      fabs;
+    deprecated alias core.stdc.complex.cabsl      fabs;
 
     ///
     alias core.stdc.math.hypot         hypot;
@@ -1439,12 +1313,10 @@  else
     ///
     alias core.stdc.math.powl          pow;
 
-    ///
-    alias core.stdc.complex.cpow       pow;
-    ///
-    alias core.stdc.complex.cpowf      pow;
-    ///
-    alias core.stdc.complex.cpowl      pow;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.cpow       pow;
+    deprecated alias core.stdc.complex.cpowf      pow;
+    deprecated alias core.stdc.complex.cpowl      pow;
 
     ///
     alias core.stdc.math.sqrt          sqrt;
@@ -1453,12 +1325,10 @@  else
     ///
     alias core.stdc.math.sqrtl         sqrt;
 
-    ///
-    alias core.stdc.complex.csqrt      sqrt;
-    ///
-    alias core.stdc.complex.csqrtf     sqrt;
-    ///
-    alias core.stdc.complex.csqrtl     sqrt;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.csqrt      sqrt;
+    deprecated alias core.stdc.complex.csqrtf     sqrt;
+    deprecated alias core.stdc.complex.csqrtl     sqrt;
 
     ///
     alias core.stdc.math.erf           erf;
@@ -1635,35 +1505,20 @@  else
     ///
     alias core.stdc.math.fmal          fma;
 
-    ///
-    alias core.stdc.complex.carg       carg;
-    ///
-    alias core.stdc.complex.cargf      carg;
-    ///
-    alias core.stdc.complex.cargl      carg;
-
-    ///
-    alias core.stdc.complex.cimag      cimag;
-    ///
-    alias core.stdc.complex.cimagf     cimag;
-    ///
-    alias core.stdc.complex.cimagl     cimag;
-
-    ///
-    alias core.stdc.complex.conj       conj;
-    ///
-    alias core.stdc.complex.conjf      conj;
-    ///
-    alias core.stdc.complex.conjl      conj;
-
-    ///
-    alias core.stdc.complex.cproj      cproj;
-    ///
-    alias core.stdc.complex.cprojf     cproj;
-    ///
-    alias core.stdc.complex.cprojl     cproj;
-
-//  alias core.stdc.complex.creal      creal;
-//  alias core.stdc.complex.crealf     creal;
-//  alias core.stdc.complex.creall     creal;
+    // @@@DEPRECATED_2.105@@@
+    deprecated alias core.stdc.complex.carg       carg;
+    deprecated alias core.stdc.complex.cargf      carg;
+    deprecated alias core.stdc.complex.cargl      carg;
+    deprecated alias core.stdc.complex.cimag      cimag;
+    deprecated alias core.stdc.complex.cimagf     cimag;
+    deprecated alias core.stdc.complex.cimagl     cimag;
+    deprecated alias core.stdc.complex.conj       conj;
+    deprecated alias core.stdc.complex.conjf      conj;
+    deprecated alias core.stdc.complex.conjl      conj;
+    deprecated alias core.stdc.complex.cproj      cproj;
+    deprecated alias core.stdc.complex.cprojf     cproj;
+    deprecated alias core.stdc.complex.cprojl     cproj;
+//  deprecated alias core.stdc.complex.creal      creal;
+//  deprecated alias core.stdc.complex.crealf     creal;
+//  deprecated alias core.stdc.complex.creall     creal;
 }
diff --git a/libphobos/libdruntime/core/stdc/wchar_.d b/libphobos/libdruntime/core/stdc/wchar_.d
index eecc8ef918e..6da5618ada6 100644
--- a/libphobos/libdruntime/core/stdc/wchar_.d
+++ b/libphobos/libdruntime/core/stdc/wchar_.d
@@ -173,12 +173,13 @@  extern (D) @trusted
     wint_t getwchar()                     { return fgetwc(stdin);     }
     ///
     wint_t putwchar(wchar_t c)            { return fputwc(c,stdout);  }
-    ///
-    wint_t getwc(FILE* stream)            { return fgetwc(stream);    }
-    ///
-    wint_t putwc(wchar_t c, FILE* stream) { return fputwc(c, stream); }
 }
 
+///
+alias getwc = fgetwc;
+///
+alias putwc = fputwc;
+
 // No unsafe pointer manipulation.
 @trusted
 {
diff --git a/libphobos/libdruntime/core/sys/darwin/fcntl.d b/libphobos/libdruntime/core/sys/darwin/fcntl.d
new file mode 100644
index 00000000000..47d895ad6cb
--- /dev/null
+++ b/libphobos/libdruntime/core/sys/darwin/fcntl.d
@@ -0,0 +1,20 @@ 
+module core.sys.darwin.fcntl;
+
+public import core.sys.posix.fcntl;
+
+version (OSX)
+    version = Darwin;
+else version (iOS)
+    version = Darwin;
+else version (TVOS)
+    version = Darwin;
+else version (WatchOS)
+    version = Darwin;
+
+version (Darwin):
+extern (C):
+nothrow:
+@nogc:
+@system:
+
+enum F_FULLFSYNC = 51;
diff --git a/libphobos/libdruntime/core/sys/linux/epoll.d b/libphobos/libdruntime/core/sys/linux/epoll.d
index 0c3aed98853..f5ff7dba0f8 100644
--- a/libphobos/libdruntime/core/sys/linux/epoll.d
+++ b/libphobos/libdruntime/core/sys/linux/epoll.d
@@ -10,6 +10,8 @@  module core.sys.linux.epoll;
 
 version (linux):
 
+import core.sys.posix.signal : sigset_t;
+
 extern (C):
 @system:
 @nogc:
@@ -52,16 +54,19 @@  enum
     EPOLLHUP    = 0x010,
     EPOLLRDHUP  = 0x2000, // since Linux 2.6.17
     EPOLLEXCLUSIVE = 1u << 28, // since Linux 4.5
+    EPOLLWAKEUP = 1u << 29,
     EPOLLONESHOT = 1u << 30,
     EPOLLET     = 1u << 31
 }
 
-/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl().  */
+/**
+ * Valid opcodes ( "op" parameter ) to issue to epoll_ctl().
+ */
 enum
 {
-    EPOLL_CTL_ADD = 1, // Add a file descriptor to the interface.
-    EPOLL_CTL_DEL = 2, // Remove a file descriptor from the interface.
-    EPOLL_CTL_MOD = 3, // Change file descriptor epoll_event structure.
+    EPOLL_CTL_ADD = 1, /// Add a file descriptor to the interface.
+    EPOLL_CTL_DEL = 2, /// Remove a file descriptor from the interface.
+    EPOLL_CTL_MOD = 3, /// Change file descriptor epoll_event structure.
 }
 
 version (X86_Any)
@@ -142,7 +147,82 @@  union epoll_data_t
     ulong u64;
 }
 
+/**
+ * Creates an epoll instance.
+ *
+ * Params:
+ *   size = a hint specifying the number of file descriptors to be associated
+ *          with the new instance.  T
+ * Returns: an fd for the new instance. The fd returned by epoll_create() should
+ *          be closed with close().
+ * See_also: epoll_create1 (int flags)
+ */
 int epoll_create (int size);
+
+/* Same as epoll_create but with an FLAGS parameter.  The unused SIZE
+   parameter has been dropped.  */
+
+/**
+ * Creates an epoll instance.
+ *
+ * Params:
+ *   flags = a specified flag. If flags is 0, then, other than the fact that the
+ *           obsolete size argument is dropped, epoll_create1() is the same as
+ *           epoll_create().
+ * Returns: an fd for the new instance. The fd returned by epoll_create() should
+ *          be closed with close().
+ * See_also: epoll_create (int size)
+ */
 int epoll_create1 (int flags);
+
+/**
+ * Manipulate an epoll instance
+ *
+ * Params:
+ *   epfd = an epoll file descriptor instance
+ *   op = one of the EPOLL_CTL_* constants
+ *   fd = target file descriptor of the operation
+ *   event = describes which events the caller is interested in and any
+ *           associated user dat
+ * Returns: 0 in case of success, -1 in case of error ( the "errno" variable
+ *          will contain the specific error code )
+ */
 int epoll_ctl (int epfd, int op, int fd, epoll_event *event);
+
+
+/**
+ * Wait for events on an epoll instance.
+ *
+ *
+ * Params:
+ *   epfd = an epoll file descriptor instance
+ *   events = a buffer that will contain triggered events
+ *   maxevents = the maximum number of events to be returned ( usually size of
+ *               "events" )
+ *   timeout = specifies the maximum wait time in milliseconds (-1 == infinite)
+ *
+ * Returns: the number of triggered events returned in "events" buffer. Or -1 in
+ *          case of error with the "errno" variable set to the specific error
+ *          code.
+ */
 int epoll_wait (int epfd, epoll_event *events, int maxevents, int timeout);
+
+/**
+ * Wait for events on an epoll instance
+ *
+ *
+ * Params:
+ *   epfd = an epoll file descriptor instance
+ *   events = a buffer that will contain triggered events
+ *   maxevents = the maximum number of events to be returned ( usually size of
+ *               "events" )
+ *   timeout = specifies the maximum wait time in milliseconds (-1 == infinite)
+ *   ss = a signal set. May be specified as `null`, in which case epoll_pwait() is
+ *        equivalent to epoll_wait().
+ *
+ * Returns: the number of triggered events returned in "events" buffer. Or -1 in
+ *          case of error with the "errno" variable set to the specific error
+ *          code.
+ */
+int epoll_pwait (int epfd, epoll_event *events, int maxevents, int timeout,
+    const sigset_t *ss);
diff --git a/libphobos/libdruntime/core/sys/openbsd/string.d b/libphobos/libdruntime/core/sys/openbsd/string.d
index 8d35b9c9c12..cb978c8249b 100644
--- a/libphobos/libdruntime/core/sys/openbsd/string.d
+++ b/libphobos/libdruntime/core/sys/openbsd/string.d
@@ -18,4 +18,6 @@  nothrow:
 static if (__BSD_VISIBLE)
 {
     pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
+    pure int timingsafe_bcmp(scope const void*, scope const void*, size_t);
+    pure int timingsafe_memcmp(scope const void*, scope const void*, size_t);
 }
diff --git a/libphobos/libdruntime/core/sys/openbsd/unistd.d b/libphobos/libdruntime/core/sys/openbsd/unistd.d
new file mode 100644
index 00000000000..ddd102cdeae
--- /dev/null
+++ b/libphobos/libdruntime/core/sys/openbsd/unistd.d
@@ -0,0 +1,17 @@ 
+/**
+  * D header file for OpenBSD unistd.h.
+  *
+  * Copyright: Copyright © 2021, The D Language Foundation
+  * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
+  * Authors: Brian Callahan
+  */
+module core.sys.openbsd.unistd;
+public import core.sys.posix.unistd;
+
+version (OpenBSD):
+extern (C):
+nothrow:
+@nogc:
+
+int pledge(const scope char*, const scope char*);
+int unveil(const scope char*, const scope char*);
diff --git a/libphobos/libdruntime/core/sys/posix/config.d b/libphobos/libdruntime/core/sys/posix/config.d
index c02debffadd..3b575fa5b48 100644
--- a/libphobos/libdruntime/core/sys/posix/config.d
+++ b/libphobos/libdruntime/core/sys/posix/config.d
@@ -117,6 +117,7 @@  else version (CRuntime_UClibc)
 else version (CRuntime_Bionic)
 {
     enum _GNU_SOURCE         = false;
+    enum __USE_FILE_OFFSET64 = false; // see https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md
     enum __USE_GNU           = _GNU_SOURCE;
 
     version (D_LP64)
diff --git a/libphobos/libdruntime/core/sys/posix/dlfcn.d b/libphobos/libdruntime/core/sys/posix/dlfcn.d
index e97c7ea3960..2477e26dc53 100644
--- a/libphobos/libdruntime/core/sys/posix/dlfcn.d
+++ b/libphobos/libdruntime/core/sys/posix/dlfcn.d
@@ -139,7 +139,7 @@  else version (Darwin)
     char* dlerror();
     void* dlopen(const scope char*, int);
     void* dlsym(void*, const scope char*);
-    int   dladdr(void* addr, Dl_info* info);
+    int   dladdr(scope const void* addr, Dl_info* info);
 
     struct Dl_info
     {
@@ -294,6 +294,15 @@  else version (CRuntime_Musl)
     const(char)* dlerror();
     void*        dlopen(const scope char*, int);
     void*        dlsym(void*, const scope char*);
+
+    int dladdr(scope const void *addr, Dl_info *info);
+    struct Dl_info
+    {
+        const(char)* dli_fname;
+        void*        dli_fbase;
+        const(char)* dli_sname;
+        void*        dli_saddr;
+    }
 }
 else version (CRuntime_UClibc)
 {
diff --git a/libphobos/libdruntime/core/sys/posix/signal.d b/libphobos/libdruntime/core/sys/posix/signal.d
index 44f45f2e0c3..0dce8c53f31 100644
--- a/libphobos/libdruntime/core/sys/posix/signal.d
+++ b/libphobos/libdruntime/core/sys/posix/signal.d
@@ -3503,7 +3503,7 @@  struct sigevent
     pthread_attr_t* sigev_notify_attributes;
 }
 
-int sigqueue(pid_t, int, in sigval);
+int sigqueue(pid_t, int, const sigval);
 int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
 int sigwaitinfo(const scope sigset_t*, siginfo_t*);
 */
@@ -3543,7 +3543,7 @@  version (CRuntime_Glibc)
         } _sigev_un_t _sigev_un;
     }
 
-    int sigqueue(pid_t, int, in sigval);
+    int sigqueue(pid_t, int, const sigval);
     int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
     int sigwaitinfo(const scope sigset_t*, siginfo_t*);
 }
@@ -3566,7 +3566,7 @@  else version (FreeBSD)
         }
     }
 
-    int sigqueue(pid_t, int, in sigval);
+    int sigqueue(pid_t, int, const sigval);
     int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
     int sigwaitinfo(const scope sigset_t*, siginfo_t*);
 }
@@ -3581,7 +3581,7 @@  else version (NetBSD)
         void /* pthread_attr_t */*sigev_notify_attributes;
     }
 
-    int sigqueue(pid_t, int, in sigval);
+    int sigqueue(pid_t, int, const sigval);
     int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
     int sigwaitinfo(const scope sigset_t*, siginfo_t*);
 }
@@ -3613,7 +3613,7 @@  else version (DragonFlyBSD)
         void function(_sigval_t)  sigev_notify_function;
     }
 
-    int sigqueue(pid_t, int, in sigval);
+    int sigqueue(pid_t, int, const sigval);
     int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
     int sigwaitinfo(const scope sigset_t*, siginfo_t*);
 }
@@ -3640,7 +3640,7 @@  else version (Solaris)
         int __sigev_pad2;
     }
 
-    int sigqueue(pid_t, int, in sigval);
+    int sigqueue(pid_t, int, const sigval);
     int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
     int sigwaitinfo(const scope sigset_t*, siginfo_t*);
 }
@@ -3717,7 +3717,7 @@  else version (CRuntime_UClibc)
     @property void function(sigval) sigev_notify_function(ref sigevent _sigevent) { return _sigevent._sigev_un._sigev_thread._function; }
     @property void* sigev_notify_attributes(ref sigevent _sigevent) { return  _sigevent._sigev_un._sigev_thread._attribute; }
 
-    int sigqueue(pid_t, int, in sigval);
+    int sigqueue(pid_t, int, const sigval);
     int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*);
     int sigwaitinfo(const scope sigset_t*, siginfo_t*);
 }
diff --git a/libphobos/libdruntime/core/sys/posix/unistd.d b/libphobos/libdruntime/core/sys/posix/unistd.d
index a691884cb2e..d996556fca0 100644
--- a/libphobos/libdruntime/core/sys/posix/unistd.d
+++ b/libphobos/libdruntime/core/sys/posix/unistd.d
@@ -2722,3 +2722,51 @@  else version (CRuntime_UClibc)
     int        truncate(const scope char*, off_t);
   }
 }
+
+// Non-standard definition to access user process environment
+version (CRuntime_Glibc)
+{
+    extern __gshared const char** environ;
+}
+else version (Darwin)
+{
+    extern (D) @property const(char**) environ()()
+    {
+        pragma (inline, true);
+        import core.sys.darwin.crt_externs : _NSGetEnviron;
+        return *_NSGetEnviron();
+    }
+}
+else version (FreeBSD)
+{
+    extern __gshared const char** environ;
+}
+else version (NetBSD)
+{
+    extern __gshared const char** environ;
+}
+else version (OpenBSD)
+{
+    extern __gshared const char** environ;
+}
+else version (DragonFlyBSD)
+{
+    extern __gshared const char** environ;
+}
+else version (CRuntime_Bionic)
+{
+    extern __gshared const char** environ;
+}
+else version (CRuntime_Musl)
+{
+    extern __gshared const char** environ;
+}
+else version (Solaris)
+{
+    extern __gshared const char** environ;
+}
+else version (CRuntime_UClibc)
+{
+    extern __gshared const char** __environ;
+    alias environ = __environ;
+}
diff --git a/libphobos/libdruntime/core/sys/windows/com.d b/libphobos/libdruntime/core/sys/windows/com.d
index 90a294343fc..88007adb141 100644
--- a/libphobos/libdruntime/core/sys/windows/com.d
+++ b/libphobos/libdruntime/core/sys/windows/com.d
@@ -39,16 +39,16 @@  public import core.sys.windows.winerror :
     RPC_E_CHANGED_MODE;
 
 public import core.sys.windows.wtypes :
-    OLECHAR, LPOLESTR, LPCOLESTR;
-
-alias CLSCTX_INPROC_SERVER     = core.sys.windows.wtypes.CLSCTX.CLSCTX_INPROC_SERVER    ;
-alias CLSCTX_INPROC_HANDLER    = core.sys.windows.wtypes.CLSCTX.CLSCTX_INPROC_HANDLER   ;
-alias CLSCTX_LOCAL_SERVER      = core.sys.windows.wtypes.CLSCTX.CLSCTX_LOCAL_SERVER     ;
-alias CLSCTX_INPROC_SERVER16   = core.sys.windows.wtypes.CLSCTX.CLSCTX_INPROC_SERVER16  ;
-alias CLSCTX_REMOTE_SERVER     = core.sys.windows.wtypes.CLSCTX.CLSCTX_REMOTE_SERVER    ;
-alias CLSCTX_INPROC_HANDLER16  = core.sys.windows.wtypes.CLSCTX.CLSCTX_INPROC_HANDLER16 ;
-alias CLSCTX_INPROC_SERVERX86  = core.sys.windows.wtypes.CLSCTX.CLSCTX_INPROC_SERVERX86 ;
-alias CLSCTX_INPROC_HANDLERX86 = core.sys.windows.wtypes.CLSCTX.CLSCTX_INPROC_HANDLERX86;
+    CLSCTX, OLECHAR, LPOLESTR, LPCOLESTR;
+
+alias CLSCTX_INPROC_SERVER     = CLSCTX.CLSCTX_INPROC_SERVER    ;
+alias CLSCTX_INPROC_HANDLER    = CLSCTX.CLSCTX_INPROC_HANDLER   ;
+alias CLSCTX_LOCAL_SERVER      = CLSCTX.CLSCTX_LOCAL_SERVER     ;
+alias CLSCTX_INPROC_SERVER16   = CLSCTX.CLSCTX_INPROC_SERVER16  ;
+alias CLSCTX_REMOTE_SERVER     = CLSCTX.CLSCTX_REMOTE_SERVER    ;
+alias CLSCTX_INPROC_HANDLER16  = CLSCTX.CLSCTX_INPROC_HANDLER16 ;
+alias CLSCTX_INPROC_SERVERX86  = CLSCTX.CLSCTX_INPROC_SERVERX86 ;
+alias CLSCTX_INPROC_HANDLERX86 = CLSCTX.CLSCTX_INPROC_HANDLERX86;
 
 alias COINIT_APARTMENTTHREADED   = COINIT.COINIT_APARTMENTTHREADED;
 alias COINIT_MULTITHREADED       = COINIT.COINIT_MULTITHREADED    ;
diff --git a/libphobos/libdruntime/core/sys/windows/dll.d b/libphobos/libdruntime/core/sys/windows/dll.d
index 9f36ac389a6..3df0d7fd41b 100644
--- a/libphobos/libdruntime/core/sys/windows/dll.d
+++ b/libphobos/libdruntime/core/sys/windows/dll.d
@@ -31,17 +31,7 @@  public import core.sys.windows.threadaux;
 //  not access tls_array[tls_index] as needed for thread local _tlsstart and _tlsend
 extern (C)
 {
-        version (MinGW)
-        {
-            extern __gshared void* _tls_start;
-            extern __gshared void* _tls_end;
-            extern __gshared void* __xl_a;
-
-            alias _tls_start _tlsstart;
-            alias _tls_end   _tlsend;
-            alias __xl_a     _tls_callbacks_a;
-        }
-        else version (Win32)
+    version (Win32)
     {
         version (CRuntime_DigitalMars)
         {
diff --git a/libphobos/libdruntime/core/sys/windows/stdc/malloc.d b/libphobos/libdruntime/core/sys/windows/stdc/malloc.d
new file mode 100644
index 00000000000..f52ba37f27e
--- /dev/null
+++ b/libphobos/libdruntime/core/sys/windows/stdc/malloc.d
@@ -0,0 +1,26 @@ 
+/**
+  * D header file for Windows malloc.h.
+ *
+ * Translated from MinGW Windows headers
+ *
+ * Authors: Iain Buclaw
+ * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
+ * Source: $(DRUNTIMESRC src/core/sys/windows/stdc/_malloc.d)
+ */
+module core.sys.windows.stdc.malloc;
+version (CRuntime_Microsoft):
+extern (C):
+@system:
+nothrow:
+@nogc:
+
+export void* _recalloc(void*, size_t, size_t);
+
+export void _aligned_free(void*);
+export void* _aligned_malloc(size_t, size_t);
+
+export void* _aligned_offset_malloc(size_t, size_t, size_t);
+export void* _aligned_realloc(void*, size_t, size_t);
+export void* _aligned_recalloc(void*, size_t, size_t, size_t);
+export void* _aligned_offset_realloc(void*, size_t, size_t, size_t);
+export void* _aligned_offset_recalloc(void*, size_t, size_t, size_t, size_t);
diff --git a/libphobos/libdruntime/gc/impl/conservative/gc.d b/libphobos/libdruntime/gc/impl/conservative/gc.d
index b7bb9b0c36f..300a32ad2b0 100644
--- a/libphobos/libdruntime/gc/impl/conservative/gc.d
+++ b/libphobos/libdruntime/gc/impl/conservative/gc.d
@@ -76,7 +76,7 @@  debug(PRINTF_TO_FILE)
                 gcStartTick = MonoTime.currTime;
             immutable timeElapsed = MonoTime.currTime - gcStartTick;
             immutable secondsAsDouble = timeElapsed.total!"hnsecs" / cast(double)convert!("seconds", "hnsecs")(1);
-            len = fprintf(gcx_fh, "%10.6lf: ", secondsAsDouble);
+            len = fprintf(gcx_fh, "%10.6f: ", secondsAsDouble);
         }
         len += fprintf(gcx_fh, fmt, args);
         fflush(gcx_fh);
@@ -159,7 +159,7 @@  debug (LOGGING)
             printf("    p = %p, size = %zd, parent = %p ", p, size, parent);
             if (file)
             {
-                printf("%s(%u)", file, line);
+                printf("%s(%u)", file, cast(uint)line);
             }
             printf("\n");
         }
diff --git a/libphobos/libdruntime/object.d b/libphobos/libdruntime/object.d
index 04d54575a5b..c05643bf36d 100644
--- a/libphobos/libdruntime/object.d
+++ b/libphobos/libdruntime/object.d
@@ -19,10 +19,11 @@  private
 alias size_t = typeof(int.sizeof);
 alias ptrdiff_t = typeof(cast(void*)0 - cast(void*)0);
 
-alias sizediff_t = ptrdiff_t; //For backwards compatibility only.
+alias sizediff_t = ptrdiff_t; // For backwards compatibility only.
+alias noreturn = typeof(*null);  /// bottom type
 
-alias hash_t = size_t; //For backwards compatibility only.
-alias equals_t = bool; //For backwards compatibility only.
+alias hash_t = size_t; // For backwards compatibility only.
+alias equals_t = bool; // For backwards compatibility only.
 
 alias string  = immutable(char)[];
 alias wstring = immutable(wchar)[];
diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE
index 6de04b453ff..4f6a168350b 100644
--- a/libphobos/src/MERGE
+++ b/libphobos/src/MERGE
@@ -1,4 +1,4 @@ 
-9d575282edeccecbc061e615bf2486fd07e8c084
+f89dc217a680fa1a83f2999fea04b7c562f705ee
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/phobos repository.
diff --git a/libphobos/src/Makefile.am b/libphobos/src/Makefile.am
index 0dc2a2625a9..2dedc740f16 100644
--- a/libphobos/src/Makefile.am
+++ b/libphobos/src/Makefile.am
@@ -135,11 +135,11 @@  PHOBOS_DSOURCES = etc/c/curl.d etc/c/sqlite3.d etc/c/zlib.d \
 	std/regex/internal/backtracking.d std/regex/internal/generator.d \
 	std/regex/internal/ir.d std/regex/internal/kickstart.d \
 	std/regex/internal/parser.d std/regex/internal/tests.d \
-	std/regex/internal/thompson.d std/regex/package.d std/signals.d \
-	std/socket.d std/stdint.d std/stdio.d std/string.d std/system.d \
-	std/traits.d std/typecons.d std/typetuple.d std/uni.d std/uri.d \
-	std/utf.d std/uuid.d std/variant.d std/windows/charset.d \
-	std/windows/registry.d std/windows/syserror.d std/xml.d std/zip.d \
-	std/zlib.d
+	std/regex/internal/tests2.d std/regex/internal/thompson.d \
+	std/regex/package.d std/signals.d std/socket.d std/stdint.d \
+	std/stdio.d std/string.d std/system.d std/traits.d std/typecons.d \
+	std/typetuple.d std/uni.d std/uri.d std/utf.d std/uuid.d std/variant.d \
+	std/windows/charset.d std/windows/registry.d std/windows/syserror.d \
+	std/xml.d std/zip.d std/zlib.d
 
 endif
diff --git a/libphobos/src/Makefile.in b/libphobos/src/Makefile.in
index 33453517153..9e410e5b642 100644
--- a/libphobos/src/Makefile.in
+++ b/libphobos/src/Makefile.in
@@ -249,6 +249,7 @@  am__dirstamp = $(am__leading_dot)dirstamp
 @ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/regex/internal/kickstart.lo \
 @ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/regex/internal/parser.lo \
 @ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/regex/internal/tests.lo \
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/regex/internal/tests2.lo \
 @ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/regex/internal/thompson.lo \
 @ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/regex/package.lo \
 @ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/signals.lo std/socket.lo \
@@ -572,12 +573,12 @@  libgphobos_la_LINK = $(LIBTOOL) --tag=D $(libgphobos_la_LIBTOOLFLAGS) \
 @ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/regex/internal/backtracking.d std/regex/internal/generator.d \
 @ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/regex/internal/ir.d std/regex/internal/kickstart.d \
 @ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/regex/internal/parser.d std/regex/internal/tests.d \
-@ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/regex/internal/thompson.d std/regex/package.d std/signals.d \
-@ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/socket.d std/stdint.d std/stdio.d std/string.d std/system.d \
-@ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/traits.d std/typecons.d std/typetuple.d std/uni.d std/uri.d \
-@ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/utf.d std/uuid.d std/variant.d std/windows/charset.d \
-@ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/windows/registry.d std/windows/syserror.d std/xml.d std/zip.d \
-@ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/zlib.d
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/regex/internal/tests2.d std/regex/internal/thompson.d \
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/regex/package.d std/signals.d std/socket.d std/stdint.d \
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/stdio.d std/string.d std/system.d std/traits.d std/typecons.d \
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/typetuple.d std/uni.d std/uri.d std/utf.d std/uuid.d std/variant.d \
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/windows/charset.d std/windows/registry.d std/windows/syserror.d \
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@	std/xml.d std/zip.d std/zlib.d
 
 
 # Source file definitions. Boring stuff, auto-generated with
@@ -851,6 +852,7 @@  std/regex/internal/ir.lo: std/regex/internal/$(am__dirstamp)
 std/regex/internal/kickstart.lo: std/regex/internal/$(am__dirstamp)
 std/regex/internal/parser.lo: std/regex/internal/$(am__dirstamp)
 std/regex/internal/tests.lo: std/regex/internal/$(am__dirstamp)
+std/regex/internal/tests2.lo: std/regex/internal/$(am__dirstamp)
 std/regex/internal/thompson.lo: std/regex/internal/$(am__dirstamp)
 std/regex/$(am__dirstamp):
 	@$(MKDIR_P) std/regex
diff --git a/libphobos/src/std/algorithm/iteration.d b/libphobos/src/std/algorithm/iteration.d
index c77792d3024..19cfb77053d 100644
--- a/libphobos/src/std/algorithm/iteration.d
+++ b/libphobos/src/std/algorithm/iteration.d
@@ -769,9 +769,9 @@  private struct MapResult(alias fun, Range)
     string  s1 = "hello world!";
     dstring s2 = "日本語";
     dstring s3 = "hello world!"d;
-    auto ms1 = map!(std.ascii.toUpper)(s1);
-    auto ms2 = map!(std.ascii.toUpper)(s2);
-    auto ms3 = map!(std.ascii.toUpper)(s3);
+    auto ms1 = map!(toUpper)(s1);
+    auto ms2 = map!(toUpper)(s2);
+    auto ms3 = map!(toUpper)(s3);
     static assert(!is(ms1[0])); //narrow strings can't be indexed
     assert(ms2[0] == '日');
     assert(ms3[0] == 'H');
@@ -4450,7 +4450,7 @@  private struct SplitterResult(alias isTerminator, Range)
         ["là", "dove", "terminava", "quella", "valle"]
     ));
     assert(equal(
-        splitter!(std.uni.isWhite)("là dove terminava quella valle"),
+        splitter!(isWhite)("là dove terminava quella valle"),
         ["là", "dove", "terminava", "quella", "valle"]
     ));
     assert(equal(splitter!"a=='本'"("日本語"), ["日", "語"]));
diff --git a/libphobos/src/std/algorithm/searching.d b/libphobos/src/std/algorithm/searching.d
index 6468a87469c..09073f6d1aa 100644
--- a/libphobos/src/std/algorithm/searching.d
+++ b/libphobos/src/std/algorithm/searching.d
@@ -959,8 +959,8 @@  if (isInputRange!R &&
     import std.ascii : isDigit;
     import std.uni : isWhite;
 
-    assert(countUntil!(std.uni.isWhite)("hello world") == 5);
-    assert(countUntil!(std.ascii.isDigit)("hello world") == -1);
+    assert(countUntil!(isWhite)("hello world") == 5);
+    assert(countUntil!(isDigit)("hello world") == -1);
     assert(countUntil!"a > 20"([0, 7, 12, 22, 9]) == 3);
 }
 
diff --git a/libphobos/src/std/container/rbtree.d b/libphobos/src/std/container/rbtree.d
index 861da5e09fb..5e31ac2989b 100644
--- a/libphobos/src/std/container/rbtree.d
+++ b/libphobos/src/std/container/rbtree.d
@@ -1814,8 +1814,8 @@  assert(equal(rbt[], [5]));
     test!byte();
 }
 
-import std.range.primitives : isInputRange, isSomeString, ElementType;
-import std.traits : isArray;
+import std.range.primitives : isInputRange, ElementType;
+import std.traits : isArray, isSomeString;
 
 /++
     Convenience function for creating a $(D RedBlackTree!E) from a list of
diff --git a/libphobos/src/std/conv.d b/libphobos/src/std/conv.d
index 31cc6517173..3560d134f58 100644
--- a/libphobos/src/std/conv.d
+++ b/libphobos/src/std/conv.d
@@ -3967,7 +3967,7 @@  if (isOctalLiteral(num))
 
 /// Ditto
 template octal(alias decimalInteger)
-if (isIntegral!(typeof(decimalInteger)))
+if (is(typeof(decimalInteger)) && isIntegral!(typeof(decimalInteger)))
 {
     enum octal = octal!(typeof(decimalInteger))(to!string(decimalInteger));
 }
diff --git a/libphobos/src/std/datetime/systime.d b/libphobos/src/std/datetime/systime.d
index b2291910616..913d360c655 100644
--- a/libphobos/src/std/datetime/systime.d
+++ b/libphobos/src/std/datetime/systime.d
@@ -9569,7 +9569,7 @@  afterMon: stripAndCheckLen(value[3 .. value.length], "1200:00A".length);
     }
 
     // year
-    auto found = value[2 .. value.length].find!(not!(std.ascii.isDigit))();
+    auto found = value[2 .. value.length].find!(not!(isDigit))();
     size_t yearLen = value.length - found.length;
     if (found.length == 0)
         throw new DateTimeException("Invalid year");
@@ -9659,7 +9659,7 @@  afterMon: stripAndCheckLen(value[3 .. value.length], "1200:00A".length);
             case "J": case "j": throw new DateTimeException("Invalid timezone");
             default:
             {
-                if (all!(std.ascii.isAlpha)(value[0 .. tzLen]))
+                if (all!(isAlpha)(value[0 .. tzLen]))
                 {
                     tz = new immutable SimpleTimeZone(Duration.zero);
                     break;
diff --git a/libphobos/src/std/experimental/logger/nulllogger.d b/libphobos/src/std/experimental/logger/nulllogger.d
index fa511be2b3f..0c55377d0f9 100644
--- a/libphobos/src/std/experimental/logger/nulllogger.d
+++ b/libphobos/src/std/experimental/logger/nulllogger.d
@@ -31,7 +31,7 @@  class NullLogger : Logger
 ///
 @safe unittest
 {
-    import std.experimental.logger.nulllogger : LogLevel;
+    import std.experimental.logger.core : LogLevel;
 
     auto nl1 = new NullLogger(LogLevel.all);
     nl1.info("You will never read this.");
diff --git a/libphobos/src/std/experimental/typecons.d b/libphobos/src/std/experimental/typecons.d
index 6906f05a4a8..07eed8fad69 100644
--- a/libphobos/src/std/experimental/typecons.d
+++ b/libphobos/src/std/experimental/typecons.d
@@ -23,8 +23,7 @@  module std.experimental.typecons;
 import std.meta; // : AliasSeq, allSatisfy;
 import std.traits;
 
-import std.typecons : Tuple, tuple, Bind, DerivedFunctionType,
-       isImplicitlyConvertible, mixinAll, staticIota,
+import std.typecons : Tuple, tuple, Bind, DerivedFunctionType, mixinAll, staticIota,
        GetOverloadedMethods;
 
 private
@@ -113,7 +112,8 @@  if (Targets.length >= 1 && allSatisfy!(isMutable, Targets))
             else
             {
                 enum foundFunc = findCovariantFunction!(TargetMembers[i], Source, SourceMembers);
-                debug
+                version (unittest) {}
+                else debug
                 {
                     static if (foundFunc == -1)
                         pragma(msg, "Could not locate matching function for: ",
diff --git a/libphobos/src/std/file.d b/libphobos/src/std/file.d
index 13a3db0ff66..99530cbbeb0 100644
--- a/libphobos/src/std/file.d
+++ b/libphobos/src/std/file.d
@@ -2301,7 +2301,7 @@  if (isConvertibleToString!R)
 
 @safe unittest
 {
-    import std.path : mkdir;
+    import std.file : mkdir;
     static assert(__traits(compiles, mkdir(TestAliasedString(null))));
 }
 
@@ -4112,7 +4112,8 @@  auto dirEntries(string path, SpanMode mode, bool followSymlink = true)
     import std.algorithm.searching : startsWith;
     import std.array : array;
     import std.conv : to;
-    import std.path : dirEntries, buildPath, absolutePath;
+    import std.path : buildPath, absolutePath;
+    import std.file : dirEntries;
     import std.process : thisProcessID;
     import std.range.primitives : walkLength;
 
diff --git a/libphobos/src/std/format.d b/libphobos/src/std/format.d
index 64b1bd30e2c..17e5906baf7 100644
--- a/libphobos/src/std/format.d
+++ b/libphobos/src/std/format.d
@@ -5199,7 +5199,7 @@  body
     }
     debug (unformatRange) printf("\t");
     debug (unformatRange) if (!input.empty) printf("input.front = %c, ", input.front);
-    debug (unformatRange) printf("cont = %.*s\n", cont);
+    debug (unformatRange) printf("cont = %.*s\n", cast(int) cont.length, cont.ptr);
 
     bool checkEnd()
     {
@@ -5246,7 +5246,7 @@  body
             auto sep = spec.sep !is null ? spec.sep
                          : fmt.trailing;
             debug (unformatRange) {
-            if (!sep.empty && !input.empty) printf("-> %c, sep = %.*s\n", input.front, sep);
+            if (!sep.empty && !input.empty) printf("-> %c, sep = %.*s\n", input.front, cast(int) sep.length, sep.ptr);
             else                            printf("\n");
             }
 
diff --git a/libphobos/src/std/internal/math/biguintcore.d b/libphobos/src/std/internal/math/biguintcore.d
index f5cd769e7f2..6fc2d16734f 100644
--- a/libphobos/src/std/internal/math/biguintcore.d
+++ b/libphobos/src/std/internal/math/biguintcore.d
@@ -2503,13 +2503,13 @@  pure nothrow
     void printBiguint(const uint [] data)
     {
         char [] buff = biguintToHex(new char[data.length*9], data, '_');
-        printf("%.*s\n", buff.length, buff.ptr);
+        printf("%.*s\n", cast(int) buff.length, buff.ptr);
     }
 
     void printDecimalBigUint(BigUint data)
     {
         auto str = data.toDecimalString(0);
-        printf("%.*s\n", str.length, str.ptr);
+        printf("%.*s\n", cast(int) str.length, str.ptr);
     }
 
     uint [] a, b;
diff --git a/libphobos/src/std/math.d b/libphobos/src/std/math.d
index ff368b79f9d..336c11a55e2 100644
--- a/libphobos/src/std/math.d
+++ b/libphobos/src/std/math.d
@@ -263,8 +263,8 @@  version (unittest)
             alias real_t = double;
         else
             alias real_t = real;
-        ix = sprintf(bufx.ptr, "%.*Lg", ndigits, cast(real_t) x);
-        iy = sprintf(bufy.ptr, "%.*Lg", ndigits, cast(real_t) y);
+        ix = sprintf(bufx.ptr, is(real_t == real) ? "%.*Lg" : "%.*g", ndigits, cast(real_t) x);
+        iy = sprintf(bufy.ptr, is(real_t == real) ? "%.*Lg" : "%.*g", ndigits, cast(real_t) y);
         assert(ix < bufx.length && ix > 0);
         assert(ix < bufy.length && ix > 0);
 
diff --git a/libphobos/src/std/parallelism.d b/libphobos/src/std/parallelism.d
index 43a1ba59527..61d5cea55f9 100644
--- a/libphobos/src/std/parallelism.d
+++ b/libphobos/src/std/parallelism.d
@@ -4000,7 +4000,7 @@  version (unittest)
     import std.array : split;
     import std.conv : text;
     import std.exception : assertThrown;
-    import std.math : approxEqual, sqrt, log;
+    import std.math : approxEqual, sqrt, log, abs;
     import std.range : indexed, iota, join;
     import std.typecons : Tuple, tuple;
 
@@ -4329,7 +4329,7 @@  version (unittest)
 
     assert(equal(iota(1_000_000), bufTrickTest));
 
-    auto myTask = task!(std.math.abs)(-1);
+    auto myTask = task!(abs)(-1);
     taskPool.put(myTask);
     assert(myTask.spinForce == 1);
 
diff --git a/libphobos/src/std/range/package.d b/libphobos/src/std/range/package.d
index 13601cb9da9..deedb689974 100644
--- a/libphobos/src/std/range/package.d
+++ b/libphobos/src/std/range/package.d
@@ -11379,7 +11379,6 @@  if (isInputRange!R && isIntegral!(ElementType!R))
         bw.popFront();
         assert(bw[2 * bitsNum - 3] == true);
 
-        import core.exception : Error;
         import std.exception : assertThrown;
 
         // Check out of bounds error
diff --git a/libphobos/src/std/regex/internal/tests.d b/libphobos/src/std/regex/internal/tests.d
index 1c4f295c4ca..fe75ce03c0a 100644
--- a/libphobos/src/std/regex/internal/tests.d
+++ b/libphobos/src/std/regex/internal/tests.d
@@ -8,7 +8,7 @@  package(std.regex):
 import std.conv, std.exception, std.meta, std.range,
     std.typecons, std.regex;
 
-import std.regex.internal.parser : Escapables; // characters that need escaping
+import std.regex.internal.ir : Escapables; // characters that need escaping
 
 alias Sequence(int B, int E) = staticIota!(B, E);
 
@@ -467,654 +467,3 @@  alias Sequence(int B, int E) = staticIota!(B, E);
     run_tests!match(); //thompson VM
 }
 
-@safe unittest
-{
-    auto cr = ctRegex!("abc");
-    assert(bmatch("abc",cr).hit == "abc");
-    auto cr2 = ctRegex!("ab*c");
-    assert(bmatch("abbbbc",cr2).hit == "abbbbc");
-}
-@safe unittest
-{
-    auto cr3 = ctRegex!("^abc$");
-    assert(bmatch("abc",cr3).hit == "abc");
-    auto cr4 = ctRegex!(`\b(a\B[a-z]b)\b`);
-    assert(array(match("azb",cr4).captures) == ["azb", "azb"]);
-}
-
-@safe unittest
-{
-    auto cr5 = ctRegex!("(?:a{2,4}b{1,3}){1,2}");
-    assert(bmatch("aaabaaaabbb", cr5).hit == "aaabaaaabbb");
-    auto cr6 = ctRegex!("(?:a{2,4}b{1,3}){1,2}?"w);
-    assert(bmatch("aaabaaaabbb"w,  cr6).hit == "aaab"w);
-}
-
-@safe unittest
-{
-    auto cr7 = ctRegex!(`\r.*?$`,"sm");
-    assert(bmatch("abc\r\nxy",  cr7).hit == "\r\nxy");
-    auto greed =  ctRegex!("<packet.*?/packet>");
-    assert(bmatch("<packet>text</packet><packet>text</packet>", greed).hit
-            == "<packet>text</packet>");
-}
-
-@safe unittest
-{
-    import std.algorithm.comparison : equal;
-    auto cr8 = ctRegex!("^(a)(b)?(c*)");
-    auto m8 = bmatch("abcc",cr8);
-    assert(m8);
-    assert(m8.captures[1] == "a");
-    assert(m8.captures[2] == "b");
-    assert(m8.captures[3] == "cc");
-    auto cr9 = ctRegex!("q(a|b)*q");
-    auto m9 = match("xxqababqyy",cr9);
-    assert(m9);
-    assert(equal(bmatch("xxqababqyy",cr9).captures, ["qababq", "b"]));
-}
-
-@safe unittest
-{
-    import std.algorithm.comparison : equal;
-    auto rtr = regex("a|b|c");
-    enum ctr = regex("a|b|c");
-    assert(equal(rtr.ir,ctr.ir));
-    //CTFE parser BUG is triggered by group
-    //in the middle of alternation (at least not first and not last)
-    enum testCT = regex(`abc|(edf)|xyz`);
-    auto testRT = regex(`abc|(edf)|xyz`);
-    assert(equal(testCT.ir,testRT.ir));
-}
-
-@safe unittest
-{
-    import std.algorithm.comparison : equal;
-    import std.algorithm.iteration : map;
-    enum cx = ctRegex!"(A|B|C)";
-    auto mx = match("B",cx);
-    assert(mx);
-    assert(equal(mx.captures, [ "B", "B"]));
-    enum cx2 = ctRegex!"(A|B)*";
-    assert(match("BAAA",cx2));
-
-    enum cx3 = ctRegex!("a{3,4}","i");
-    auto mx3 = match("AaA",cx3);
-    assert(mx3);
-    assert(mx3.captures[0] == "AaA");
-    enum cx4 = ctRegex!(`^a{3,4}?[a-zA-Z0-9~]{1,2}`,"i");
-    auto mx4 = match("aaaabc", cx4);
-    assert(mx4);
-    assert(mx4.captures[0] == "aaaab");
-    auto cr8 = ctRegex!("(a)(b)?(c*)");
-    auto m8 = bmatch("abcc",cr8);
-    assert(m8);
-    assert(m8.captures[1] == "a");
-    assert(m8.captures[2] == "b");
-    assert(m8.captures[3] == "cc");
-    auto cr9 = ctRegex!(".*$", "gm");
-    auto m9 = match("First\rSecond", cr9);
-    assert(m9);
-    assert(equal(map!"a.hit"(m9), ["First", "", "Second"]));
-}
-
-@safe unittest
-{
-    import std.algorithm.comparison : equal;
-    import std.algorithm.iteration : map;
-//global matching
-    void test_body(alias matchFn)()
-    {
-        string s = "a quick brown fox jumps over a lazy dog";
-        auto r1 = regex("\\b[a-z]+\\b","g");
-        string[] test;
-        foreach (m; matchFn(s, r1))
-            test ~= m.hit;
-        assert(equal(test, [ "a", "quick", "brown", "fox", "jumps", "over", "a", "lazy", "dog"]));
-        auto free_reg = regex(`
-
-            abc
-            \s+
-            "
-            (
-                    [^"]+
-                |   \\ "
-            )+
-            "
-            z
-        `, "x");
-        auto m = match(`abc  "quoted string with \" inside"z`,free_reg);
-        assert(m);
-        string mails = " hey@you.com no@spam.net ";
-        auto rm = regex(`@(?<=\S+@)\S+`,"g");
-        assert(equal(map!"a[0]"(matchFn(mails, rm)), ["@you.com", "@spam.net"]));
-        auto m2 = matchFn("First line\nSecond line",regex(".*$","gm"));
-        assert(equal(map!"a[0]"(m2), ["First line", "", "Second line"]));
-        auto m2a = matchFn("First line\nSecond line",regex(".+$","gm"));
-        assert(equal(map!"a[0]"(m2a), ["First line", "Second line"]));
-        auto m2b = matchFn("First line\nSecond line",regex(".+?$","gm"));
-        assert(equal(map!"a[0]"(m2b), ["First line", "Second line"]));
-        debug(std_regex_test) writeln("!!! FReD FLAGS test done "~matchFn.stringof~" !!!");
-    }
-    test_body!bmatch();
-    test_body!match();
-}
-
-//tests for accumulated std.regex issues and other regressions
-@safe unittest
-{
-    import std.algorithm.comparison : equal;
-    import std.algorithm.iteration : map;
-    void test_body(alias matchFn)()
-    {
-        //issue 5857
-        //matching goes out of control if ... in (...){x} has .*/.+
-        auto c = matchFn("axxxzayyyyyzd",regex("(a.*z){2}d")).captures;
-        assert(c[0] == "axxxzayyyyyzd");
-        assert(c[1] == "ayyyyyz");
-        auto c2 = matchFn("axxxayyyyyd",regex("(a.*){2}d")).captures;
-        assert(c2[0] == "axxxayyyyyd");
-        assert(c2[1] == "ayyyyy");
-        //issue 2108
-        //greedy vs non-greedy
-        auto nogreed = regex("<packet.*?/packet>");
-        assert(matchFn("<packet>text</packet><packet>text</packet>", nogreed).hit
-               == "<packet>text</packet>");
-        auto greed =  regex("<packet.*/packet>");
-        assert(matchFn("<packet>text</packet><packet>text</packet>", greed).hit
-               == "<packet>text</packet><packet>text</packet>");
-        //issue 4574
-        //empty successful match still advances the input
-        string[] pres, posts, hits;
-        foreach (m; matchFn("abcabc", regex("","g")))
-        {
-            pres ~= m.pre;
-            posts ~= m.post;
-            assert(m.hit.empty);
-
-        }
-        auto heads = [
-            "abcabc",
-            "abcab",
-            "abca",
-            "abc",
-            "ab",
-            "a",
-            ""
-        ];
-        auto tails = [
-            "abcabc",
-             "bcabc",
-              "cabc",
-               "abc",
-                "bc",
-                 "c",
-                  ""
-        ];
-        assert(pres == array(retro(heads)));
-        assert(posts == tails);
-        //issue 6076
-        //regression on .*
-        auto re = regex("c.*|d");
-        auto m = matchFn("mm", re);
-        assert(!m);
-        debug(std_regex_test) writeln("!!! FReD REGRESSION test done "~matchFn.stringof~" !!!");
-        auto rprealloc = regex(`((.){5}.{1,10}){5}`);
-        auto arr = array(repeat('0',100));
-        auto m2 = matchFn(arr, rprealloc);
-        assert(m2);
-        assert(collectException(
-                regex(r"^(import|file|binary|config)\s+([^\(]+)\(?([^\)]*)\)?\s*$")
-                ) is null);
-        foreach (ch; [Escapables])
-        {
-            assert(match(to!string(ch),regex(`[\`~ch~`]`)));
-            assert(!match(to!string(ch),regex(`[^\`~ch~`]`)));
-            assert(match(to!string(ch),regex(`[\`~ch~`-\`~ch~`]`)));
-        }
-        //bugzilla 7718
-        string strcmd = "./myApp.rb -os OSX -path \"/GIT/Ruby Apps/sec\" -conf 'notimer'";
-        auto reStrCmd = regex (`(".*")|('.*')`, "g");
-        assert(equal(map!"a[0]"(matchFn(strcmd, reStrCmd)),
-                     [`"/GIT/Ruby Apps/sec"`, `'notimer'`]));
-    }
-    test_body!bmatch();
-    test_body!match();
-}
-
-// tests for replace
-@safe unittest
-{
-    void test(alias matchFn)()
-    {
-        import std.uni : toUpper;
-
-        foreach (i, v; AliasSeq!(string, wstring, dstring))
-        {
-            auto baz(Cap)(Cap m)
-            if (is(Cap == Captures!(Cap.String)))
-            {
-                return toUpper(m.hit);
-            }
-            alias String = v;
-            assert(std.regex.replace!(matchFn)(to!String("ark rapacity"), regex(to!String("r")), to!String("c"))
-                   == to!String("ack rapacity"));
-            assert(std.regex.replace!(matchFn)(to!String("ark rapacity"), regex(to!String("r"), "g"), to!String("c"))
-                   == to!String("ack capacity"));
-            assert(std.regex.replace!(matchFn)(to!String("noon"), regex(to!String("^n")), to!String("[$&]"))
-                   == to!String("[n]oon"));
-            assert(std.regex.replace!(matchFn)(
-                to!String("test1 test2"), regex(to!String(`\w+`),"g"), to!String("$`:$'")
-            ) == to!String(": test2 test1 :"));
-            auto s = std.regex.replace!(baz!(Captures!(String)))(to!String("Strap a rocket engine on a chicken."),
-                    regex(to!String("[ar]"), "g"));
-            assert(s == "StRAp A Rocket engine on A chicken.");
-        }
-        debug(std_regex_test) writeln("!!! Replace test done "~matchFn.stringof~"  !!!");
-    }
-    test!(bmatch)();
-    test!(match)();
-}
-
-// tests for splitter
-@safe unittest
-{
-    import std.algorithm.comparison : equal;
-    auto s1 = ", abc, de,     fg, hi, ";
-    auto sp1 = splitter(s1, regex(", *"));
-    auto w1 = ["", "abc", "de", "fg", "hi", ""];
-    assert(equal(sp1, w1));
-
-    auto s2 = ", abc, de,  fg, hi";
-    auto sp2 = splitter(s2, regex(", *"));
-    auto w2 = ["", "abc", "de", "fg", "hi"];
-
-    uint cnt;
-    foreach (e; sp2)
-    {
-        assert(w2[cnt++] == e);
-    }
-    assert(equal(sp2, w2));
-}
-
-@safe unittest
-{
-    char[] s1 = ", abc, de,  fg, hi, ".dup;
-    auto sp2 = splitter(s1, regex(", *"));
-}
-
-@safe unittest
-{
-    import std.algorithm.comparison : equal;
-    auto s1 = ", abc, de,  fg, hi, ";
-    auto w1 = ["", "abc", "de", "fg", "hi", ""];
-    assert(equal(split(s1, regex(", *")), w1[]));
-}
-
-@safe unittest
-{ // bugzilla 7141
-    string pattern = `[a\--b]`;
-    assert(match("-", pattern));
-    assert(match("b", pattern));
-    string pattern2 = `[&-z]`;
-    assert(match("b", pattern2));
-}
-@safe unittest
-{//bugzilla 7111
-    assert(match("", regex("^")));
-}
-@safe unittest
-{//bugzilla 7300
-    assert(!match("a"d, "aa"d));
-}
-
-// bugzilla 7551
-@safe unittest
-{
-    auto r = regex("[]abc]*");
-    assert("]ab".matchFirst(r).hit == "]ab");
-    assertThrown(regex("[]"));
-    auto r2 = regex("[]abc--ab]*");
-    assert("]ac".matchFirst(r2).hit == "]");
-}
-
-@safe unittest
-{//bugzilla 7674
-    assert("1234".replace(regex("^"), "$$") == "$1234");
-    assert("hello?".replace(regex(r"\?", "g"), r"\?") == r"hello\?");
-    assert("hello?".replace(regex(r"\?", "g"), r"\\?") != r"hello\?");
-}
-@safe unittest
-{// bugzilla 7679
-    import std.algorithm.comparison : equal;
-    foreach (S; AliasSeq!(string, wstring, dstring))
-    (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
-        enum re = ctRegex!(to!S(r"\."));
-        auto str = to!S("a.b");
-        assert(equal(std.regex.splitter(str, re), [to!S("a"), to!S("b")]));
-        assert(split(str, re) == [to!S("a"), to!S("b")]);
-    }();
-}
-@safe unittest
-{//bugzilla 8203
-    string data = "
-    NAME   = XPAW01_STA:STATION
-    NAME   = XPAW01_STA
-    ";
-    auto uniFileOld = data;
-    auto r = regex(
-       r"^NAME   = (?P<comp>[a-zA-Z0-9_]+):*(?P<blk>[a-zA-Z0-9_]*)","gm");
-    auto uniCapturesNew = match(uniFileOld, r);
-    for (int i = 0; i < 20; i++)
-        foreach (matchNew; uniCapturesNew) {}
-    //a second issue with same symptoms
-    auto r2 = regex(`([а-яА-Я\-_]+\s*)+(?<=[\s\.,\^])`);
-    match("аллея Театральная", r2);
-}
-@safe unittest
-{// bugzilla 8637 purity of enforce
-    auto m = match("hello world", regex("world"));
-    enforce(m);
-}
-
-// bugzilla 8725
-@safe unittest
-{
-  static italic = regex( r"\*
-                (?!\s+)
-                (.*?)
-                (?!\s+)
-                \*", "gx" );
-  string input = "this * is* interesting, *very* interesting";
-  assert(replace(input, italic, "<i>$1</i>") ==
-      "this * is* interesting, <i>very</i> interesting");
-}
-
-// bugzilla 8349
-@safe unittest
-{
-    enum peakRegexStr = r"\>(wgEncode.*Tfbs.*\.(?:narrow)|(?:broad)Peak.gz)</a>";
-    enum peakRegex = ctRegex!(peakRegexStr);
-    //note that the regex pattern itself is probably bogus
-    assert(match(r"\>wgEncode-blah-Tfbs.narrow</a>", peakRegex));
-}
-
-// bugzilla 9211
-@safe unittest
-{
-    import std.algorithm.comparison : equal;
-    auto rx_1 =  regex(r"^(\w)*(\d)");
-    auto m = match("1234", rx_1);
-    assert(equal(m.front, ["1234", "3", "4"]));
-    auto rx_2 = regex(r"^([0-9])*(\d)");
-    auto m2 = match("1234", rx_2);
-    assert(equal(m2.front, ["1234", "3", "4"]));
-}
-
-// bugzilla 9280
-@safe unittest
-{
-    string tomatch = "a!b@c";
-    static r = regex(r"^(?P<nick>.*?)!(?P<ident>.*?)@(?P<host>.*?)$");
-    auto nm = match(tomatch, r);
-    assert(nm);
-    auto c = nm.captures;
-    assert(c[1] == "a");
-    assert(c["nick"] == "a");
-}
-
-
-// bugzilla 9579
-@safe unittest
-{
-    char[] input = ['a', 'b', 'c'];
-    string format = "($1)";
-    // used to give a compile error:
-    auto re = regex(`(a)`, "g");
-    auto r = replace(input, re, format);
-    assert(r == "(a)bc");
-}
-
-// bugzilla 9634
-@safe unittest
-{
-    auto re = ctRegex!"(?:a+)";
-    assert(match("aaaa", re).hit == "aaaa");
-}
-
-//bugzilla 10798
-@safe unittest
-{
-    auto cr = ctRegex!("[abcd--c]*");
-    auto m  = "abc".match(cr);
-    assert(m);
-    assert(m.hit == "ab");
-}
-
-// bugzilla 10913
-@system unittest
-{
-    @system static string foo(const(char)[] s)
-    {
-        return s.dup;
-    }
-    @safe static string bar(const(char)[] s)
-    {
-        return s.dup;
-    }
-    () @system {
-        replace!((a) => foo(a.hit))("blah", regex(`a`));
-    }();
-    () @safe {
-        replace!((a) => bar(a.hit))("blah", regex(`a`));
-    }();
-}
-
-// bugzilla 11262
-@safe unittest
-{
-    enum reg = ctRegex!(r",", "g");
-    auto str = "This,List";
-    str = str.replace(reg, "-");
-    assert(str == "This-List");
-}
-
-// bugzilla 11775
-@safe unittest
-{
-    assert(collectException(regex("a{1,0}")));
-}
-
-// bugzilla 11839
-@safe unittest
-{
-    import std.algorithm.comparison : equal;
-    assert(regex(`(?P<var1>\w+)`).namedCaptures.equal(["var1"]));
-    assert(collectException(regex(`(?P<1>\w+)`)));
-    assert(regex(`(?P<v1>\w+)`).namedCaptures.equal(["v1"]));
-    assert(regex(`(?P<__>\w+)`).namedCaptures.equal(["__"]));
-    assert(regex(`(?P<я>\w+)`).namedCaptures.equal(["я"]));
-}
-
-// bugzilla 12076
-@safe unittest
-{
-    auto RE = ctRegex!(r"(?<!x[a-z]+)\s([a-z]+)");
-    string s = "one two";
-    auto m = match(s, RE);
-}
-
-// bugzilla 12105
-@safe unittest
-{
-    auto r = ctRegex!`.*?(?!a)`;
-    assert("aaab".matchFirst(r).hit == "aaa");
-    auto r2 = ctRegex!`.*(?!a)`;
-    assert("aaab".matchFirst(r2).hit == "aaab");
-}
-
-//bugzilla 11784
-@safe unittest
-{
-    assert("abcdefghijklmnopqrstuvwxyz"
-        .matchFirst("[a-z&&[^aeiuo]]").hit == "b");
-}
-
-//bugzilla 12366
-@safe unittest
-{
-     auto re = ctRegex!(`^((?=(xx+?)\2+$)((?=\2+$)(?=(x+)(\4+$))\5){2})*x?$`);
-     assert("xxxxxxxx".match(re).empty);
-     assert(!"xxxx".match(re).empty);
-}
-
-// bugzilla 12582
-@safe unittest
-{
-    auto r = regex(`(?P<a>abc)`);
-    assert(collectException("abc".matchFirst(r)["b"]));
-}
-
-// bugzilla 12691
-@safe unittest
-{
-    assert(bmatch("e@", "^([a-z]|)*$").empty);
-    assert(bmatch("e@", ctRegex!`^([a-z]|)*$`).empty);
-}
-
-//bugzilla  12713
-@safe unittest
-{
-    assertThrown(regex("[[a-z]([a-z]|(([[a-z])))"));
-}
-
-//bugzilla 12747
-@safe unittest
-{
-    assertThrown(regex(`^x(\1)`));
-    assertThrown(regex(`^(x(\1))`));
-    assertThrown(regex(`^((x)(?=\1))`));
-}
-
-// bugzilla 14504
-@safe unittest
-{
-    auto p = ctRegex!("a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?" ~
-            "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
-}
-
-// bugzilla 14529
-@safe unittest
-{
-    auto ctPat2 = regex(r"^[CDF]$", "i");
-    foreach (v; ["C", "c", "D", "d", "F", "f"])
-        assert(matchAll(v, ctPat2).front.hit == v);
-}
-
-// bugzilla 14615
-@safe unittest
-{
-    import std.array : appender;
-    import std.regex : replaceFirst, replaceFirstInto, regex;
-    import std.stdio : writeln;
-
-    auto example = "Hello, world!";
-    auto pattern = regex("^Hello, (bug)");  // won't find this one
-    auto result = replaceFirst(example, pattern, "$1 Sponge Bob");
-    assert(result == "Hello, world!");  // Ok.
-
-    auto sink = appender!string;
-    replaceFirstInto(sink, example, pattern, "$1 Sponge Bob");
-    assert(sink.data == "Hello, world!");
-    replaceAllInto(sink, example, pattern, "$1 Sponge Bob");
-    assert(sink.data == "Hello, world!Hello, world!");
-}
-
-// bugzilla 15573
-@safe unittest
-{
-    auto rx = regex("[c d]", "x");
-    assert("a b".matchFirst(rx));
-}
-
-// bugzilla 15864
-@safe unittest
-{
-    regex(`(<a (?:(?:\w+=\"[^"]*\")?\s*)*href="\.\.?)"`);
-}
-
-@safe unittest
-{
-    auto r = regex("(?# comment)abc(?# comment2)");
-    assert("abc".matchFirst(r));
-    assertThrown(regex("(?#..."));
-}
-
-// bugzilla 17075
-@safe unittest
-{
-    enum titlePattern = `<title>(.+)</title>`;
-    static titleRegex = ctRegex!titlePattern;
-    string input = "<title>" ~ "<".repeat(100_000).join;
-    assert(input.matchFirst(titleRegex).empty);
-}
-
-// bugzilla 17212
-@safe unittest
-{
-    auto r = regex(" [a] ", "x");
-    assert("a".matchFirst(r));
-}
-
-// bugzilla 17157
-@safe unittest
-{
-    import std.algorithm.comparison : equal;
-    auto ctr = ctRegex!"(a)|(b)|(c)|(d)";
-    auto r = regex("(a)|(b)|(c)|(d)", "g");
-    auto s = "--a--b--c--d--";
-    auto outcomes = [
-        ["a", "a", "", "", ""],
-        ["b", "", "b", "", ""],
-        ["c", "", "", "c", ""],
-        ["d", "", "", "", "d"]
-    ];
-    assert(equal!equal(s.matchAll(ctr), outcomes));
-    assert(equal!equal(s.bmatch(r), outcomes));
-}
-
-// bugzilla 17667
-@safe unittest
-{
-    import std.algorithm.searching : canFind;
-    void willThrow(T, size_t line = __LINE__)(T arg, string msg)
-    {
-        auto e = collectException(regex(arg));
-        assert(e.msg.canFind(msg), to!string(line) ~ ": " ~ e.msg);
-    }
-    willThrow([r".", r"[\(\{[\]\}\)]"], "no matching ']' found while parsing character class");
-    willThrow([r"[\", r"123"], "no matching ']' found while parsing character class");
-    willThrow([r"[a-", r"123"], "no matching ']' found while parsing character class");
-    willThrow([r"[a-\", r"123"], "invalid escape sequence");
-    willThrow([r"\", r"123"], "invalid escape sequence");
-}
-
-// bugzilla 17668
-@safe unittest
-{
-    import std.algorithm.searching;
-    auto e = collectException!RegexException(regex(q"<[^]>"));
-    assert(e.msg.canFind("no operand for '^'"));
-}
-
-// bugzilla 17673
-@safe unittest
-{
-    string str = `<">`;
-    string[] regexps = ["abc", "\"|x"];
-    auto regexp = regex(regexps);
-    auto c = matchFirst(str, regexp);
-    assert(c);
-    assert(c.whichPattern == 2);
-}
-
diff --git a/libphobos/src/std/regex/internal/tests2.d b/libphobos/src/std/regex/internal/tests2.d
new file mode 100644
index 00000000000..420f8d3d6cc
--- /dev/null
+++ b/libphobos/src/std/regex/internal/tests2.d
@@ -0,0 +1,662 @@ 
+// Split-up due to DMD's enormous memory consumption
+
+module std.regex.internal.tests2;
+
+package(std.regex):
+
+import std.conv, std.exception, std.meta, std.range,
+    std.typecons, std.regex;
+
+import std.regex.internal.ir : Escapables; // characters that need escaping
+
+@safe unittest
+{
+    auto cr = ctRegex!("abc");
+    assert(bmatch("abc",cr).hit == "abc");
+    auto cr2 = ctRegex!("ab*c");
+    assert(bmatch("abbbbc",cr2).hit == "abbbbc");
+}
+@safe unittest
+{
+    auto cr3 = ctRegex!("^abc$");
+    assert(bmatch("abc",cr3).hit == "abc");
+    auto cr4 = ctRegex!(`\b(a\B[a-z]b)\b`);
+    assert(array(match("azb",cr4).captures) == ["azb", "azb"]);
+}
+
+@safe unittest
+{
+    auto cr5 = ctRegex!("(?:a{2,4}b{1,3}){1,2}");
+    assert(bmatch("aaabaaaabbb", cr5).hit == "aaabaaaabbb");
+    auto cr6 = ctRegex!("(?:a{2,4}b{1,3}){1,2}?"w);
+    assert(bmatch("aaabaaaabbb"w,  cr6).hit == "aaab"w);
+}
+
+@safe unittest
+{
+    auto cr7 = ctRegex!(`\r.*?$`,"sm");
+    assert(bmatch("abc\r\nxy",  cr7).hit == "\r\nxy");
+    auto greed =  ctRegex!("<packet.*?/packet>");
+    assert(bmatch("<packet>text</packet><packet>text</packet>", greed).hit
+            == "<packet>text</packet>");
+}
+
+@safe unittest
+{
+    import std.algorithm.comparison : equal;
+    auto cr8 = ctRegex!("^(a)(b)?(c*)");
+    auto m8 = bmatch("abcc",cr8);
+    assert(m8);
+    assert(m8.captures[1] == "a");
+    assert(m8.captures[2] == "b");
+    assert(m8.captures[3] == "cc");
+    auto cr9 = ctRegex!("q(a|b)*q");
+    auto m9 = match("xxqababqyy",cr9);
+    assert(m9);
+    assert(equal(bmatch("xxqababqyy",cr9).captures, ["qababq", "b"]));
+}
+
+@safe unittest
+{
+    import std.algorithm.comparison : equal;
+    auto rtr = regex("a|b|c");
+    enum ctr = regex("a|b|c");
+    assert(equal(rtr.ir,ctr.ir));
+    //CTFE parser BUG is triggered by group
+    //in the middle of alternation (at least not first and not last)
+    enum testCT = regex(`abc|(edf)|xyz`);
+    auto testRT = regex(`abc|(edf)|xyz`);
+    assert(equal(testCT.ir,testRT.ir));
+}
+
+@safe unittest
+{
+    import std.algorithm.comparison : equal;
+    import std.algorithm.iteration : map;
+    enum cx = ctRegex!"(A|B|C)";
+    auto mx = match("B",cx);
+    assert(mx);
+    assert(equal(mx.captures, [ "B", "B"]));
+    enum cx2 = ctRegex!"(A|B)*";
+    assert(match("BAAA",cx2));
+
+    enum cx3 = ctRegex!("a{3,4}","i");
+    auto mx3 = match("AaA",cx3);
+    assert(mx3);
+    assert(mx3.captures[0] == "AaA");
+    enum cx4 = ctRegex!(`^a{3,4}?[a-zA-Z0-9~]{1,2}`,"i");
+    auto mx4 = match("aaaabc", cx4);
+    assert(mx4);
+    assert(mx4.captures[0] == "aaaab");
+    auto cr8 = ctRegex!("(a)(b)?(c*)");
+    auto m8 = bmatch("abcc",cr8);
+    assert(m8);
+    assert(m8.captures[1] == "a");
+    assert(m8.captures[2] == "b");
+    assert(m8.captures[3] == "cc");
+    auto cr9 = ctRegex!(".*$", "gm");
+    auto m9 = match("First\rSecond", cr9);
+    assert(m9);
+    assert(equal(map!"a.hit"(m9), ["First", "", "Second"]));
+}
+
+@safe unittest
+{
+    import std.algorithm.comparison : equal;
+    import std.algorithm.iteration : map;
+//global matching
+    void test_body(alias matchFn)()
+    {
+        string s = "a quick brown fox jumps over a lazy dog";
+        auto r1 = regex("\\b[a-z]+\\b","g");
+        string[] test;
+        foreach (m; matchFn(s, r1))
+            test ~= m.hit;
+        assert(equal(test, [ "a", "quick", "brown", "fox", "jumps", "over", "a", "lazy", "dog"]));
+        auto free_reg = regex(`
+
+            abc
+            \s+
+            "
+            (
+                    [^"]+
+                |   \\ "
+            )+
+            "
+            z
+        `, "x");
+        auto m = match(`abc  "quoted string with \" inside"z`,free_reg);
+        assert(m);
+        string mails = " hey@you.com no@spam.net ";
+        auto rm = regex(`@(?<=\S+@)\S+`,"g");
+        assert(equal(map!"a[0]"(matchFn(mails, rm)), ["@you.com", "@spam.net"]));
+        auto m2 = matchFn("First line\nSecond line",regex(".*$","gm"));
+        assert(equal(map!"a[0]"(m2), ["First line", "", "Second line"]));
+        auto m2a = matchFn("First line\nSecond line",regex(".+$","gm"));
+        assert(equal(map!"a[0]"(m2a), ["First line", "Second line"]));
+        auto m2b = matchFn("First line\nSecond line",regex(".+?$","gm"));
+        assert(equal(map!"a[0]"(m2b), ["First line", "Second line"]));
+        debug(std_regex_test) writeln("!!! FReD FLAGS test done "~matchFn.stringof~" !!!");
+    }
+    test_body!bmatch();
+    test_body!match();
+}
+
+//tests for accumulated std.regex issues and other regressions
+@safe unittest
+{
+    import std.algorithm.comparison : equal;
+    import std.algorithm.iteration : map;
+    void test_body(alias matchFn)()
+    {
+        //issue 5857
+        //matching goes out of control if ... in (...){x} has .*/.+
+        auto c = matchFn("axxxzayyyyyzd",regex("(a.*z){2}d")).captures;
+        assert(c[0] == "axxxzayyyyyzd");
+        assert(c[1] == "ayyyyyz");
+        auto c2 = matchFn("axxxayyyyyd",regex("(a.*){2}d")).captures;
+        assert(c2[0] == "axxxayyyyyd");
+        assert(c2[1] == "ayyyyy");
+        //issue 2108
+        //greedy vs non-greedy
+        auto nogreed = regex("<packet.*?/packet>");
+        assert(matchFn("<packet>text</packet><packet>text</packet>", nogreed).hit
+               == "<packet>text</packet>");
+        auto greed =  regex("<packet.*/packet>");
+        assert(matchFn("<packet>text</packet><packet>text</packet>", greed).hit
+               == "<packet>text</packet><packet>text</packet>");
+        //issue 4574
+        //empty successful match still advances the input
+        string[] pres, posts, hits;
+        foreach (m; matchFn("abcabc", regex("","g")))
+        {
+            pres ~= m.pre;
+            posts ~= m.post;
+            assert(m.hit.empty);
+
+        }
+        auto heads = [
+            "abcabc",
+            "abcab",
+            "abca",
+            "abc",
+            "ab",
+            "a",
+            ""
+        ];
+        auto tails = [
+            "abcabc",
+             "bcabc",
+              "cabc",
+               "abc",
+                "bc",
+                 "c",
+                  ""
+        ];
+        assert(pres == array(retro(heads)));
+        assert(posts == tails);
+        //issue 6076
+        //regression on .*
+        auto re = regex("c.*|d");
+        auto m = matchFn("mm", re);
+        assert(!m);
+        debug(std_regex_test) writeln("!!! FReD REGRESSION test done "~matchFn.stringof~" !!!");
+        auto rprealloc = regex(`((.){5}.{1,10}){5}`);
+        auto arr = array(repeat('0',100));
+        auto m2 = matchFn(arr, rprealloc);
+        assert(m2);
+        assert(collectException(
+                regex(r"^(import|file|binary|config)\s+([^\(]+)\(?([^\)]*)\)?\s*$")
+                ) is null);
+        foreach (ch; [Escapables])
+        {
+            assert(match(to!string(ch),regex(`[\`~ch~`]`)));
+            assert(!match(to!string(ch),regex(`[^\`~ch~`]`)));
+            assert(match(to!string(ch),regex(`[\`~ch~`-\`~ch~`]`)));
+        }
+        //bugzilla 7718
+        string strcmd = "./myApp.rb -os OSX -path \"/GIT/Ruby Apps/sec\" -conf 'notimer'";
+        auto reStrCmd = regex (`(".*")|('.*')`, "g");
+        assert(equal(map!"a[0]"(matchFn(strcmd, reStrCmd)),
+                     [`"/GIT/Ruby Apps/sec"`, `'notimer'`]));
+    }
+    test_body!bmatch();
+    test_body!match();
+}
+
+// tests for replace
+@safe unittest
+{
+    void test(alias matchFn)()
+    {
+        import std.uni : toUpper;
+
+        foreach (i, v; AliasSeq!(string, wstring, dstring))
+        {
+            auto baz(Cap)(Cap m)
+            if (is(Cap == Captures!(Cap.String)))
+            {
+                return toUpper(m.hit);
+            }
+            alias String = v;
+            assert(std.regex.replace!(matchFn)(to!String("ark rapacity"), regex(to!String("r")), to!String("c"))
+                   == to!String("ack rapacity"));
+            assert(std.regex.replace!(matchFn)(to!String("ark rapacity"), regex(to!String("r"), "g"), to!String("c"))
+                   == to!String("ack capacity"));
+            assert(std.regex.replace!(matchFn)(to!String("noon"), regex(to!String("^n")), to!String("[$&]"))
+                   == to!String("[n]oon"));
+            assert(std.regex.replace!(matchFn)(
+                to!String("test1 test2"), regex(to!String(`\w+`),"g"), to!String("$`:$'")
+            ) == to!String(": test2 test1 :"));
+            auto s = std.regex.replace!(baz!(Captures!(String)))(to!String("Strap a rocket engine on a chicken."),
+                    regex(to!String("[ar]"), "g"));
+            assert(s == "StRAp A Rocket engine on A chicken.");
+        }
+        debug(std_regex_test) writeln("!!! Replace test done "~matchFn.stringof~"  !!!");
+    }
+    test!(bmatch)();
+    test!(match)();
+}
+
+// tests for splitter
+@safe unittest
+{
+    import std.algorithm.comparison : equal;
+    auto s1 = ", abc, de,     fg, hi, ";
+    auto sp1 = splitter(s1, regex(", *"));
+    auto w1 = ["", "abc", "de", "fg", "hi", ""];
+    assert(equal(sp1, w1));
+
+    auto s2 = ", abc, de,  fg, hi";
+    auto sp2 = splitter(s2, regex(", *"));
+    auto w2 = ["", "abc", "de", "fg", "hi"];
+
+    uint cnt;
+    foreach (e; sp2)
+    {
+        assert(w2[cnt++] == e);
+    }
+    assert(equal(sp2, w2));
+}
+
+@safe unittest
+{
+    char[] s1 = ", abc, de,  fg, hi, ".dup;
+    auto sp2 = splitter(s1, regex(", *"));
+}
+
+@safe unittest
+{
+    import std.algorithm.comparison : equal;
+    auto s1 = ", abc, de,  fg, hi, ";
+    auto w1 = ["", "abc", "de", "fg", "hi", ""];
+    assert(equal(split(s1, regex(", *")), w1[]));
+}
+
+@safe unittest
+{ // bugzilla 7141
+    string pattern = `[a\--b]`;
+    assert(match("-", pattern));
+    assert(match("b", pattern));
+    string pattern2 = `[&-z]`;
+    assert(match("b", pattern2));
+}
+@safe unittest
+{//bugzilla 7111
+    assert(match("", regex("^")));
+}
+@safe unittest
+{//bugzilla 7300
+    assert(!match("a"d, "aa"d));
+}
+
+// bugzilla 7551
+@safe unittest
+{
+    auto r = regex("[]abc]*");
+    assert("]ab".matchFirst(r).hit == "]ab");
+    assertThrown(regex("[]"));
+    auto r2 = regex("[]abc--ab]*");
+    assert("]ac".matchFirst(r2).hit == "]");
+}
+
+@safe unittest
+{//bugzilla 7674
+    assert("1234".replace(regex("^"), "$$") == "$1234");
+    assert("hello?".replace(regex(r"\?", "g"), r"\?") == r"hello\?");
+    assert("hello?".replace(regex(r"\?", "g"), r"\\?") != r"hello\?");
+}
+@safe unittest
+{// bugzilla 7679
+    import std.algorithm.comparison : equal;
+    foreach (S; AliasSeq!(string, wstring, dstring))
+    (){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
+        enum re = ctRegex!(to!S(r"\."));
+        auto str = to!S("a.b");
+        assert(equal(std.regex.splitter(str, re), [to!S("a"), to!S("b")]));
+        assert(split(str, re) == [to!S("a"), to!S("b")]);
+    }();
+}
+@safe unittest
+{//bugzilla 8203
+    string data = "
+    NAME   = XPAW01_STA:STATION
+    NAME   = XPAW01_STA
+    ";
+    auto uniFileOld = data;
+    auto r = regex(
+       r"^NAME   = (?P<comp>[a-zA-Z0-9_]+):*(?P<blk>[a-zA-Z0-9_]*)","gm");
+    auto uniCapturesNew = match(uniFileOld, r);
+    for (int i = 0; i < 20; i++)
+        foreach (matchNew; uniCapturesNew) {}
+    //a second issue with same symptoms
+    auto r2 = regex(`([а-яА-Я\-_]+\s*)+(?<=[\s\.,\^])`);
+    match("аллея Театральная", r2);
+}
+@safe unittest
+{// bugzilla 8637 purity of enforce
+    auto m = match("hello world", regex("world"));
+    enforce(m);
+}
+
+// bugzilla 8725
+@safe unittest
+{
+  static italic = regex( r"\*
+                (?!\s+)
+                (.*?)
+                (?!\s+)
+                \*", "gx" );
+  string input = "this * is* interesting, *very* interesting";
+  assert(replace(input, italic, "<i>$1</i>") ==
+      "this * is* interesting, <i>very</i> interesting");
+}
+
+// bugzilla 8349
+@safe unittest
+{
+    enum peakRegexStr = r"\>(wgEncode.*Tfbs.*\.(?:narrow)|(?:broad)Peak.gz)</a>";
+    enum peakRegex = ctRegex!(peakRegexStr);
+    //note that the regex pattern itself is probably bogus
+    assert(match(r"\>wgEncode-blah-Tfbs.narrow</a>", peakRegex));
+}
+
+// bugzilla 9211
+@safe unittest
+{
+    import std.algorithm.comparison : equal;
+    auto rx_1 =  regex(r"^(\w)*(\d)");
+    auto m = match("1234", rx_1);
+    assert(equal(m.front, ["1234", "3", "4"]));
+    auto rx_2 = regex(r"^([0-9])*(\d)");
+    auto m2 = match("1234", rx_2);
+    assert(equal(m2.front, ["1234", "3", "4"]));
+}
+
+// bugzilla 9280
+@safe unittest
+{
+    string tomatch = "a!b@c";
+    static r = regex(r"^(?P<nick>.*?)!(?P<ident>.*?)@(?P<host>.*?)$");
+    auto nm = match(tomatch, r);
+    assert(nm);
+    auto c = nm.captures;
+    assert(c[1] == "a");
+    assert(c["nick"] == "a");
+}
+
+
+// bugzilla 9579
+@safe unittest
+{
+    char[] input = ['a', 'b', 'c'];
+    string format = "($1)";
+    // used to give a compile error:
+    auto re = regex(`(a)`, "g");
+    auto r = replace(input, re, format);
+    assert(r == "(a)bc");
+}
+
+// bugzilla 9634
+@safe unittest
+{
+    auto re = ctRegex!"(?:a+)";
+    assert(match("aaaa", re).hit == "aaaa");
+}
+
+//bugzilla 10798
+@safe unittest
+{
+    auto cr = ctRegex!("[abcd--c]*");
+    auto m  = "abc".match(cr);
+    assert(m);
+    assert(m.hit == "ab");
+}
+
+// bugzilla 10913
+@system unittest
+{
+    @system static string foo(const(char)[] s)
+    {
+        return s.dup;
+    }
+    @safe static string bar(const(char)[] s)
+    {
+        return s.dup;
+    }
+    () @system {
+        replace!((a) => foo(a.hit))("blah", regex(`a`));
+    }();
+    () @safe {
+        replace!((a) => bar(a.hit))("blah", regex(`a`));
+    }();
+}
+
+// bugzilla 11262
+@safe unittest
+{
+    enum reg = ctRegex!(r",", "g");
+    auto str = "This,List";
+    str = str.replace(reg, "-");
+    assert(str == "This-List");
+}
+
+// bugzilla 11775
+@safe unittest
+{
+    assert(collectException(regex("a{1,0}")));
+}
+
+// bugzilla 11839
+@safe unittest
+{
+    import std.algorithm.comparison : equal;
+    assert(regex(`(?P<var1>\w+)`).namedCaptures.equal(["var1"]));
+    assert(collectException(regex(`(?P<1>\w+)`)));
+    assert(regex(`(?P<v1>\w+)`).namedCaptures.equal(["v1"]));
+    assert(regex(`(?P<__>\w+)`).namedCaptures.equal(["__"]));
+    assert(regex(`(?P<я>\w+)`).namedCaptures.equal(["я"]));
+}
+
+// bugzilla 12076
+@safe unittest
+{
+    auto RE = ctRegex!(r"(?<!x[a-z]+)\s([a-z]+)");
+    string s = "one two";
+    auto m = match(s, RE);
+}
+
+// bugzilla 12105
+@safe unittest
+{
+    auto r = ctRegex!`.*?(?!a)`;
+    assert("aaab".matchFirst(r).hit == "aaa");
+    auto r2 = ctRegex!`.*(?!a)`;
+    assert("aaab".matchFirst(r2).hit == "aaab");
+}
+
+//bugzilla 11784
+@safe unittest
+{
+    assert("abcdefghijklmnopqrstuvwxyz"
+        .matchFirst("[a-z&&[^aeiuo]]").hit == "b");
+}
+
+//bugzilla 12366
+@safe unittest
+{
+     auto re = ctRegex!(`^((?=(xx+?)\2+$)((?=\2+$)(?=(x+)(\4+$))\5){2})*x?$`);
+     assert("xxxxxxxx".match(re).empty);
+     assert(!"xxxx".match(re).empty);
+}
+
+// bugzilla 12582
+@safe unittest
+{
+    auto r = regex(`(?P<a>abc)`);
+    assert(collectException("abc".matchFirst(r)["b"]));
+}
+
+// bugzilla 12691
+@safe unittest
+{
+    assert(bmatch("e@", "^([a-z]|)*$").empty);
+    assert(bmatch("e@", ctRegex!`^([a-z]|)*$`).empty);
+}
+
+//bugzilla  12713
+@safe unittest
+{
+    assertThrown(regex("[[a-z]([a-z]|(([[a-z])))"));
+}
+
+//bugzilla 12747
+@safe unittest
+{
+    assertThrown(regex(`^x(\1)`));
+    assertThrown(regex(`^(x(\1))`));
+    assertThrown(regex(`^((x)(?=\1))`));
+}
+
+// bugzilla 14504
+@safe unittest
+{
+    auto p = ctRegex!("a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?" ~
+            "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+}
+
+// bugzilla 14529
+@safe unittest
+{
+    auto ctPat2 = regex(r"^[CDF]$", "i");
+    foreach (v; ["C", "c", "D", "d", "F", "f"])
+        assert(matchAll(v, ctPat2).front.hit == v);
+}
+
+// bugzilla 14615
+@safe unittest
+{
+    import std.array : appender;
+    import std.regex : replaceFirst, replaceFirstInto, regex;
+    import std.stdio : writeln;
+
+    auto example = "Hello, world!";
+    auto pattern = regex("^Hello, (bug)");  // won't find this one
+    auto result = replaceFirst(example, pattern, "$1 Sponge Bob");
+    assert(result == "Hello, world!");  // Ok.
+
+    auto sink = appender!string;
+    replaceFirstInto(sink, example, pattern, "$1 Sponge Bob");
+    assert(sink.data == "Hello, world!");
+    replaceAllInto(sink, example, pattern, "$1 Sponge Bob");
+    assert(sink.data == "Hello, world!Hello, world!");
+}
+
+// bugzilla 15573
+@safe unittest
+{
+    auto rx = regex("[c d]", "x");
+    assert("a b".matchFirst(rx));
+}
+
+// bugzilla 15864
+@safe unittest
+{
+    regex(`(<a (?:(?:\w+=\"[^"]*\")?\s*)*href="\.\.?)"`);
+}
+
+@safe unittest
+{
+    auto r = regex("(?# comment)abc(?# comment2)");
+    assert("abc".matchFirst(r));
+    assertThrown(regex("(?#..."));
+}
+
+// bugzilla 17075
+@safe unittest
+{
+    enum titlePattern = `<title>(.+)</title>`;
+    static titleRegex = ctRegex!titlePattern;
+    string input = "<title>" ~ "<".repeat(100_000).join;
+    assert(input.matchFirst(titleRegex).empty);
+}
+
+// bugzilla 17212
+@safe unittest
+{
+    auto r = regex(" [a] ", "x");
+    assert("a".matchFirst(r));
+}
+
+// bugzilla 17157
+@safe unittest
+{
+    import std.algorithm.comparison : equal;
+    auto ctr = ctRegex!"(a)|(b)|(c)|(d)";
+    auto r = regex("(a)|(b)|(c)|(d)", "g");
+    auto s = "--a--b--c--d--";
+    auto outcomes = [
+        ["a", "a", "", "", ""],
+        ["b", "", "b", "", ""],
+        ["c", "", "", "c", ""],
+        ["d", "", "", "", "d"]
+    ];
+    assert(equal!equal(s.matchAll(ctr), outcomes));
+    assert(equal!equal(s.bmatch(r), outcomes));
+}
+
+// bugzilla 17667
+@safe unittest
+{
+    import std.algorithm.searching : canFind;
+    void willThrow(T, size_t line = __LINE__)(T arg, string msg)
+    {
+        auto e = collectException(regex(arg));
+        assert(e.msg.canFind(msg), to!string(line) ~ ": " ~ e.msg);
+    }
+    willThrow([r".", r"[\(\{[\]\}\)]"], "no matching ']' found while parsing character class");
+    willThrow([r"[\", r"123"], "no matching ']' found while parsing character class");
+    willThrow([r"[a-", r"123"], "no matching ']' found while parsing character class");
+    willThrow([r"[a-\", r"123"], "invalid escape sequence");
+    willThrow([r"\", r"123"], "invalid escape sequence");
+}
+
+// bugzilla 17668
+@safe unittest
+{
+    import std.algorithm.searching;
+    auto e = collectException!RegexException(regex(q"<[^]>"));
+    assert(e.msg.canFind("no operand for '^'"));
+}
+
+// bugzilla 17673
+@safe unittest
+{
+    string str = `<">`;
+    string[] regexps = ["abc", "\"|x"];
+    auto regexp = regex(regexps);
+    auto c = matchFirst(str, regexp);
+    assert(c);
+    assert(c.whichPattern == 2);
+}
+
diff --git a/libphobos/src/std/socket.d b/libphobos/src/std/socket.d
index ecb2c8b916e..d7de153063f 100644
--- a/libphobos/src/std/socket.d
+++ b/libphobos/src/std/socket.d
@@ -85,10 +85,10 @@  else version (Posix)
         }
     }
 
+    public import core.sys.posix.netinet.in_;
     import core.sys.posix.arpa.inet;
     import core.sys.posix.fcntl;
     import core.sys.posix.netdb;
-    import core.sys.posix.netinet.in_;
     import core.sys.posix.netinet.tcp;
     import core.sys.posix.sys.select;
     import core.sys.posix.sys.socket;
diff --git a/libphobos/src/std/typecons.d b/libphobos/src/std/typecons.d
index a63227cee8b..55119fc2780 100644
--- a/libphobos/src/std/typecons.d
+++ b/libphobos/src/std/typecons.d
@@ -4204,10 +4204,11 @@  package template OverloadSet(string nam, T...)
 /*
 Used by MemberFunctionGenerator.
  */
-package template FuncInfo(alias func, /+[BUG 4217 ?]+/ T = typeof(&func))
+package template FuncInfo(alias func)
+if (is(typeof(&func)))
 {
-    alias RT = ReturnType!T;
-    alias PT = Parameters!T;
+    alias RT = ReturnType!(typeof(&func));
+    alias PT = Parameters!(typeof(&func));
 }
 package template FuncInfo(Func)
 {
@@ -4248,6 +4249,7 @@  private static:
     // Internal stuffs
     //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
     import std.format;
+    alias format = std.format.format;
 
     enum CONSTRUCTOR_NAME = "__ctor";
 
@@ -5024,7 +5026,7 @@  package template GetOverloadedMethods(T)
                     enum isMethod = false;
             }
             alias follows = AliasSeq!(
-                std.meta.Filter!(isMethod, __traits(getOverloads, T, name)),
+                Filter!(isMethod, __traits(getOverloads, T, name)),
                 follows!(i + 1));
         }
     }
diff --git a/libphobos/src/std/zip.d b/libphobos/src/std/zip.d
index 8b130ea2dd9..9e55d199a9b 100644
--- a/libphobos/src/std/zip.d
+++ b/libphobos/src/std/zip.d
@@ -263,8 +263,8 @@  final class ArchiveMember
     {
     void print()
     {
-        printf("name = '%.*s'\n", name.length, name.ptr);
-        printf("\tcomment = '%.*s'\n", comment.length, comment.ptr);
+        printf("name = '%.*s'\n", cast(int) name.length, name.ptr);
+        printf("\tcomment = '%.*s'\n", cast(int) comment.length, comment.ptr);
         printf("\tmadeVersion = x%04x\n", _madeVersion);
         printf("\textractVersion = x%04x\n", extractVersion);
         printf("\tflags = x%04x\n", flags);
@@ -348,7 +348,7 @@  final class ZipArchive
         printf("\tdiskStartDir = %u\n", diskStartDir);
         printf("\tnumEntries = %u\n", numEntries);
         printf("\ttotalEntries = %u\n", totalEntries);
-        printf("\tcomment = '%.*s'\n", comment.length, comment.ptr);
+        printf("\tcomment = '%.*s'\n", cast(int) comment.length, comment.ptr);
     }
     }
 
diff --git a/libphobos/testsuite/libphobos.exceptions/chain.d b/libphobos/testsuite/libphobos.exceptions/chain.d
index 462ba245e55..0305707fc62 100644
--- a/libphobos/testsuite/libphobos.exceptions/chain.d
+++ b/libphobos/testsuite/libphobos.exceptions/chain.d
@@ -65,14 +65,14 @@  void main()
         string prefix = "";
         for ({ size_t i; Throwable ex = original; } ex; ex = ex.next, ++i)
         {
-            printf("%.*s%.*s\n", prefix.length, prefix.ptr, ex.msg.length, ex.msg.ptr);
+            printf("%.*s%.*s\n", cast(int)prefix.length, prefix.ptr, cast(int)ex.msg.length, ex.msg.ptr);
             prefix = prefix~" ";
         }
         printf("Bypassed chain was:\n");
         prefix = "";
         for ({ size_t i; Throwable ex = original.bypassedException; } ex; ex = ex.next, ++i)
         {
-            printf("%.*s%.*s\n", prefix.length, prefix.ptr, ex.msg.length, ex.msg.ptr);
+            printf("%.*s%.*s\n", cast(int)prefix.length, prefix.ptr, cast(int)ex.msg.length, ex.msg.ptr);
             prefix = prefix~" ";
         }
     }
diff --git a/libphobos/testsuite/libphobos.exceptions/line_trace.d b/libphobos/testsuite/libphobos.exceptions/line_trace.d
index 7b75d3af277..70762ff227c 100644
--- a/libphobos/testsuite/libphobos.exceptions/line_trace.d
+++ b/libphobos/testsuite/libphobos.exceptions/line_trace.d
@@ -9,7 +9,7 @@  void main()
     {
         import core.stdc.stdio;
         auto str = e.toString();
-        printf("%.*s\n", str.length, str.ptr);
+        printf("%.*s\n", cast(int)str.length, str.ptr);
     }
 }