diff mbox series

[committed] d: Merge dmd, druntime d8e3976a58, phobos 7a6e95688

Message ID 20240202232559.93851-1-ibuclaw@gdcproject.org
State New
Headers show
Series [committed] d: Merge dmd, druntime d8e3976a58, phobos 7a6e95688 | expand

Commit Message

Iain Buclaw Feb. 2, 2024, 11:25 p.m. UTC
Hi,

This patch merges the D front-end and runtime library with upstream dmd
dmd d8e3976a58, and the standard runtime library with phobos 7a6e95688.

Synchronizing with the upstream beta release of v2.107.0.

D front-end changes:

    - Import dmd v2.107.0-beta.1.
    - A string literal as an assert condition is deprecated.
    - Added `@standalone` for module constructors.

D runtime changes:

    - Import druntime v2.107.0-beta.1.

Phobos changes:

    - Import phobos v2.107.0-beta.1.

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

Regards,
Iain.

---
gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd d8e3976a58.
	* dmd/VERSION: Bump version to v2.107.0-beta.1.
	* d-lang.cc (d_parse_file): Update for new front-end interface.
	* modules.cc (struct module_info): Add standalonectors.
	(build_module_tree): Implement @standalone.
	(register_module_decl): Likewise.

libphobos/ChangeLog:

	* libdruntime/MERGE: Merge upstream druntime d8e3976a58.
	* src/MERGE: Merge upstream phobos 7a6e95688.
---
 gcc/d/d-lang.cc                               |   4 +-
 gcc/d/dmd/MERGE                               |   2 +-
 gcc/d/dmd/VERSION                             |   2 +-
 gcc/d/dmd/access.d                            |   2 +-
 gcc/d/dmd/aggregate.d                         |   4 +-
 gcc/d/dmd/aggregate.h                         |   2 +-
 gcc/d/dmd/aliasthis.d                         |   2 +-
 gcc/d/dmd/aliasthis.h                         |   2 +-
 gcc/d/dmd/arrayop.d                           |   2 +-
 gcc/d/dmd/arraytypes.d                        |   2 +-
 gcc/d/dmd/arraytypes.h                        |   2 +-
 gcc/d/dmd/ast_node.d                          |   2 +-
 gcc/d/dmd/ast_node.h                          |   2 +-
 gcc/d/dmd/astenums.d                          |   6 +-
 gcc/d/dmd/attrib.d                            |  44 ++-
 gcc/d/dmd/attrib.h                            |  10 +-
 gcc/d/dmd/blockexit.d                         |   2 +-
 gcc/d/dmd/builtin.d                           |   2 +-
 gcc/d/dmd/canthrow.d                          |   2 +-
 gcc/d/dmd/chkformat.d                         |   2 +-
 gcc/d/dmd/clone.d                             |   4 +-
 gcc/d/dmd/common/bitfields.d                  |   2 +-
 gcc/d/dmd/common/file.d                       |   2 +-
 gcc/d/dmd/common/outbuffer.d                  |   2 +-
 gcc/d/dmd/common/outbuffer.h                  |   2 +-
 gcc/d/dmd/common/smallbuffer.d                |   6 +-
 gcc/d/dmd/compiler.d                          |   2 +-
 gcc/d/dmd/compiler.h                          |   2 +-
 gcc/d/dmd/cond.d                              |   2 +-
 gcc/d/dmd/cond.h                              |   2 +-
 gcc/d/dmd/constfold.d                         |   2 +-
 gcc/d/dmd/cparse.d                            |  44 ++-
 gcc/d/dmd/cppmangle.d                         |   2 +-
 gcc/d/dmd/ctfe.h                              |   2 +-
 gcc/d/dmd/ctfeexpr.d                          |   2 +-
 gcc/d/dmd/ctorflow.d                          |   2 +-
 gcc/d/dmd/dcast.d                             |   2 +-
 gcc/d/dmd/dclass.d                            |   2 +-
 gcc/d/dmd/declaration.d                       |   4 +-
 gcc/d/dmd/declaration.h                       |   6 +-
 gcc/d/dmd/delegatize.d                        |   2 +-
 gcc/d/dmd/denum.d                             |   4 +-
 gcc/d/dmd/dimport.d                           |   2 +-
 gcc/d/dmd/dinterpret.d                        |   2 +-
 gcc/d/dmd/dmacro.d                            |   2 +-
 gcc/d/dmd/dmangle.d                           |   4 +-
 gcc/d/dmd/dmodule.d                           |   2 +-
 gcc/d/dmd/doc.d                               |   4 +-
 gcc/d/dmd/doc.h                               |   2 +-
 gcc/d/dmd/dscope.d                            |   2 +-
 gcc/d/dmd/dstruct.d                           |   8 +-
 gcc/d/dmd/dsymbol.d                           |  32 +-
 gcc/d/dmd/dsymbol.h                           |   4 +-
 gcc/d/dmd/dsymbolsem.d                        |  42 ++-
 gcc/d/dmd/dtemplate.d                         |  12 +-
 gcc/d/dmd/dtoh.d                              |   2 +-
 gcc/d/dmd/dversion.d                          |   2 +-
 gcc/d/dmd/entity.d                            |   2 +-
 gcc/d/dmd/enum.h                              |   4 +-
 gcc/d/dmd/errors.d                            |   2 +-
 gcc/d/dmd/errors.h                            |   2 +-
 gcc/d/dmd/errorsink.d                         |   2 +-
 gcc/d/dmd/escape.d                            |   4 +-
 gcc/d/dmd/expression.d                        |   7 +-
 gcc/d/dmd/expression.h                        |   4 +-
 gcc/d/dmd/expressionsem.d                     |  17 +-
 gcc/d/dmd/file_manager.d                      | 135 +++++---
 gcc/d/dmd/foreachvar.d                        |   2 +-
 gcc/d/dmd/func.d                              |   5 +-
 gcc/d/dmd/globals.d                           |   4 +-
 gcc/d/dmd/globals.h                           |   2 +-
 gcc/d/dmd/gluelayer.d                         |   2 +-
 gcc/d/dmd/hdrgen.d                            | 323 ++++++++++--------
 gcc/d/dmd/hdrgen.h                            |   6 +-
 gcc/d/dmd/iasm.d                              |   2 +-
 gcc/d/dmd/iasmgcc.d                           |   2 +-
 gcc/d/dmd/id.d                                |   3 +-
 gcc/d/dmd/id.h                                |   2 +-
 gcc/d/dmd/identifier.d                        |   2 +-
 gcc/d/dmd/identifier.h                        |   2 +-
 gcc/d/dmd/impcnvtab.d                         |   2 +-
 gcc/d/dmd/imphint.d                           |   2 +-
 gcc/d/dmd/import.h                            |   2 +-
 gcc/d/dmd/importc.d                           |   2 +-
 gcc/d/dmd/init.d                              |   2 +-
 gcc/d/dmd/init.h                              |   2 +-
 gcc/d/dmd/initsem.d                           |   2 +-
 gcc/d/dmd/inline.d                            |   2 +-
 gcc/d/dmd/intrange.d                          |   2 +-
 gcc/d/dmd/json.d                              |   2 +-
 gcc/d/dmd/json.h                              |   2 +-
 gcc/d/dmd/lambdacomp.d                        |   2 +-
 gcc/d/dmd/lexer.d                             |   2 +-
 gcc/d/dmd/location.d                          |   2 +-
 gcc/d/dmd/mangle.h                            |   2 +-
 gcc/d/dmd/module.h                            |   2 +-
 gcc/d/dmd/mtype.d                             |  32 +-
 gcc/d/dmd/mtype.h                             |   3 +-
 gcc/d/dmd/mustuse.d                           |  19 +-
 gcc/d/dmd/nogc.d                              |   2 +-
 gcc/d/dmd/nspace.d                            |   2 +-
 gcc/d/dmd/nspace.h                            |   2 +-
 gcc/d/dmd/ob.d                                |   6 +-
 gcc/d/dmd/objc.d                              |   2 +-
 gcc/d/dmd/objc.h                              |   2 +-
 gcc/d/dmd/opover.d                            |   2 +-
 gcc/d/dmd/optimize.d                          |   2 +-
 gcc/d/dmd/parse.d                             |  10 +-
 gcc/d/dmd/postordervisitor.d                  |   2 +-
 gcc/d/dmd/printast.d                          |   2 +-
 gcc/d/dmd/root/aav.d                          |   2 +-
 gcc/d/dmd/root/array.d                        |   2 +-
 gcc/d/dmd/root/array.h                        |   2 +-
 gcc/d/dmd/root/bitarray.d                     |   2 +-
 gcc/d/dmd/root/bitarray.h                     |   2 +-
 gcc/d/dmd/root/complex.d                      |   2 +-
 gcc/d/dmd/root/complex_t.h                    |   2 +-
 gcc/d/dmd/root/ctfloat.d                      |   2 +-
 gcc/d/dmd/root/ctfloat.h                      |   2 +-
 gcc/d/dmd/root/dcompat.h                      |   2 +-
 gcc/d/dmd/root/file.d                         |   2 +-
 gcc/d/dmd/root/filename.d                     |   2 +-
 gcc/d/dmd/root/filename.h                     |   2 +-
 gcc/d/dmd/root/hash.d                         |   2 +-
 gcc/d/dmd/root/object.h                       |   2 +-
 gcc/d/dmd/root/optional.d                     |   2 +-
 gcc/d/dmd/root/optional.h                     |   2 +-
 gcc/d/dmd/root/port.d                         |   2 +-
 gcc/d/dmd/root/port.h                         |   2 +-
 gcc/d/dmd/root/region.d                       |   2 +-
 gcc/d/dmd/root/rmem.d                         |   2 +-
 gcc/d/dmd/root/rmem.h                         |   2 +-
 gcc/d/dmd/root/speller.d                      |   2 +-
 gcc/d/dmd/root/string.d                       |   2 +-
 gcc/d/dmd/root/stringtable.d                  |   2 +-
 gcc/d/dmd/root/utf.d                          |   2 +-
 gcc/d/dmd/rootobject.d                        |   2 +-
 gcc/d/dmd/safe.d                              |   2 +-
 gcc/d/dmd/sapply.d                            |   2 +-
 gcc/d/dmd/scope.h                             |   2 +-
 gcc/d/dmd/semantic2.d                         |   9 +-
 gcc/d/dmd/semantic3.d                         |   2 +-
 gcc/d/dmd/sideeffect.d                        |   2 +-
 gcc/d/dmd/statement.d                         |   2 +-
 gcc/d/dmd/statement.h                         |   2 +-
 gcc/d/dmd/statement_rewrite_walker.d          |   2 +-
 gcc/d/dmd/statementsem.d                      |  69 ++--
 gcc/d/dmd/staticassert.d                      |   6 +-
 gcc/d/dmd/staticassert.h                      |   4 +-
 gcc/d/dmd/staticcond.d                        |   2 +-
 gcc/d/dmd/stmtstate.d                         |   2 +-
 gcc/d/dmd/target.d                            |   2 +-
 gcc/d/dmd/target.h                            |   2 +-
 gcc/d/dmd/template.h                          |   6 +-
 gcc/d/dmd/templateparamsem.d                  |   2 +-
 gcc/d/dmd/tokens.d                            | 154 +++++----
 gcc/d/dmd/tokens.h                            |   2 +-
 gcc/d/dmd/traits.d                            |   2 +-
 gcc/d/dmd/typesem.d                           |  37 +-
 gcc/d/dmd/typinf.d                            |   2 +-
 gcc/d/dmd/typinf.h                            |   2 +-
 gcc/d/dmd/utils.d                             |   2 +-
 gcc/d/dmd/version.h                           |   2 +-
 gcc/d/dmd/visitor.d                           |   2 +-
 gcc/d/dmd/visitor.h                           |   2 +-
 gcc/d/modules.cc                              |  22 +-
 .../gdc.test/compilable/issue20339.d          |  44 +++
 .../gdc.test/fail_compilation/array_bool.d    |  22 ++
 .../gdc.test/fail_compilation/diag11425.d     |   3 +-
 .../gdc.test/fail_compilation/diagin.d        |   2 +-
 .../gdc.test/fail_compilation/fail110.d       |   9 +-
 .../gdc.test/fail_compilation/fail19890a.d    |   4 +-
 .../gdc.test/fail_compilation/fail19890b.d    |   4 +-
 .../gdc.test/fail_compilation/fail2195.d      |   3 +-
 .../gdc.test/fail_compilation/fail24301.d     |  19 ++
 .../gdc.test/fail_compilation/fail4611.d      |   4 +-
 .../gdc.test/fail_compilation/fail93.d        |   3 +-
 .../fail_compilation/standalone_modctor.d     |  15 +
 .../fail_compilation/staticarrayoverflow.d    |   6 +-
 .../gdc.test/runnable/imports/standalone_b.d  |  11 +
 .../gdc.test/runnable/standalone_modctor.d    |  19 ++
 .../runnable_cxx/extra-files/test24292.cpp    |  46 +++
 .../gdc.test/runnable_cxx/test24292.d         |  50 +++
 libphobos/libdruntime/MERGE                   |   2 +-
 libphobos/libdruntime/__builtins.di           |   4 +
 libphobos/libdruntime/core/attribute.d        |  12 +
 libphobos/libdruntime/core/math.d             |   9 -
 libphobos/libdruntime/core/stdcpp/new_.d      |   4 +
 .../libdruntime/core/sys/posix/net/if_.d      |  17 +-
 libphobos/libdruntime/rt/sections.d           |   5 +-
 libphobos/src/MERGE                           |   2 +-
 libphobos/src/std/conv.d                      |  29 +-
 libphobos/src/std/datetime/package.d          |  10 +-
 libphobos/src/std/datetime/systime.d          |  72 ++--
 libphobos/src/std/math/algebraic.d            |  37 +-
 libphobos/src/std/net/curl.d                  |  58 ++--
 196 files changed, 1202 insertions(+), 702 deletions(-)
 create mode 100644 gcc/testsuite/gdc.test/compilable/issue20339.d
 create mode 100644 gcc/testsuite/gdc.test/fail_compilation/array_bool.d
 create mode 100644 gcc/testsuite/gdc.test/fail_compilation/fail24301.d
 create mode 100644 gcc/testsuite/gdc.test/fail_compilation/standalone_modctor.d
 create mode 100644 gcc/testsuite/gdc.test/runnable/imports/standalone_b.d
 create mode 100644 gcc/testsuite/gdc.test/runnable/standalone_modctor.d
 create mode 100644 gcc/testsuite/gdc.test/runnable_cxx/extra-files/test24292.cpp
 create mode 100644 gcc/testsuite/gdc.test/runnable_cxx/test24292.d
diff mbox series

Patch

diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc
index a25d0316da6..71f8473e0ec 100644
--- a/gcc/d/d-lang.cc
+++ b/gcc/d/d-lang.cc
@@ -1209,7 +1209,7 @@  d_parse_file (void)
 	    message ("import    %s", m->toChars ());
 
 	  OutBuffer buf;
-	  genhdrfile (m, buf);
+	  genhdrfile (m, global.params.dihdr.fullOutput, buf);
 	  d_write_file (m->hdrfile.toChars (), buf.peekChars ());
 	}
 
@@ -1373,7 +1373,7 @@  d_parse_file (void)
 	  OutBuffer buf;
 	  buf.doindent = 1;
 
-	  moduleToBuffer (buf, m);
+	  moduleToBuffer (buf, true, m);
 	  message ("%s", buf.peekChars ());
 	}
     }
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE
index fa7004b7a41..2b4400f398e 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -1,4 +1,4 @@ 
-f1a045928e03239b9477f9497f43f2cf0e61e959
+d8e3976a58d6aef7c2c9371028a2ca4460b5b2ce
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/dmd repository.
diff --git a/gcc/d/dmd/VERSION b/gcc/d/dmd/VERSION
index 9d7be5b4326..b9813c7ff3b 100644
--- a/gcc/d/dmd/VERSION
+++ b/gcc/d/dmd/VERSION
@@ -1 +1 @@ 
-v2.106.1-rc.1
+v2.107.0-beta.1
diff --git a/gcc/d/dmd/access.d b/gcc/d/dmd/access.d
index 1010c140b68..8d022030173 100644
--- a/gcc/d/dmd/access.d
+++ b/gcc/d/dmd/access.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/attribute.html#visibility_attributes, Visibility Attributes)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/access.d, _access.d)
diff --git a/gcc/d/dmd/aggregate.d b/gcc/d/dmd/aggregate.d
index 352ca88f470..2d320426c23 100644
--- a/gcc/d/dmd/aggregate.d
+++ b/gcc/d/dmd/aggregate.d
@@ -4,7 +4,7 @@ 
  * Specification: $(LINK2 https://dlang.org/spec/struct.html, Structs, Unions),
  *                $(LINK2 https://dlang.org/spec/class.html, Class).
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/aggregate.d, _aggregate.d)
@@ -65,7 +65,7 @@  enum ClassKind : ubyte
  * Returns:
  *     0-terminated string for `c`
  */
-const(char)* toChars(ClassKind c) @safe
+const(char)* ClassKindToChars(ClassKind c) @safe
 {
     final switch (c)
     {
diff --git a/gcc/d/dmd/aggregate.h b/gcc/d/dmd/aggregate.h
index 98fa6bd1bb0..9abdd094b3f 100644
--- a/gcc/d/dmd/aggregate.h
+++ b/gcc/d/dmd/aggregate.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/aliasthis.d b/gcc/d/dmd/aliasthis.d
index 0c156360fdc..0e063caa2fc 100644
--- a/gcc/d/dmd/aliasthis.d
+++ b/gcc/d/dmd/aliasthis.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/class.html#alias-this, Alias This)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/aliasthis.d, _aliasthis.d)
diff --git a/gcc/d/dmd/aliasthis.h b/gcc/d/dmd/aliasthis.h
index 092490fd5de..88ba35319b3 100644
--- a/gcc/d/dmd/aliasthis.h
+++ b/gcc/d/dmd/aliasthis.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 2009-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 2009-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/arrayop.d b/gcc/d/dmd/arrayop.d
index c3b8526a9a4..afe6054f4aa 100644
--- a/gcc/d/dmd/arrayop.d
+++ b/gcc/d/dmd/arrayop.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/arrays.html#array-operations, Array Operations)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/arrayop.d, _arrayop.d)
diff --git a/gcc/d/dmd/arraytypes.d b/gcc/d/dmd/arraytypes.d
index 6634a6af1fc..feab9a49c7c 100644
--- a/gcc/d/dmd/arraytypes.d
+++ b/gcc/d/dmd/arraytypes.d
@@ -1,7 +1,7 @@ 
 /**
  * Provide aliases for arrays of certain declarations or statements.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/arraytypes.d, _arraytypes.d)
diff --git a/gcc/d/dmd/arraytypes.h b/gcc/d/dmd/arraytypes.h
index 05126a53d7e..779642813f5 100644
--- a/gcc/d/dmd/arraytypes.h
+++ b/gcc/d/dmd/arraytypes.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 2006-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 2006-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/ast_node.d b/gcc/d/dmd/ast_node.d
index 313c2bd3691..c8c95fa0782 100644
--- a/gcc/d/dmd/ast_node.d
+++ b/gcc/d/dmd/ast_node.d
@@ -1,7 +1,7 @@ 
 /**
  * Defines the base class for all nodes which are part of the AST.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/ast_node.d, _ast_node.d)
diff --git a/gcc/d/dmd/ast_node.h b/gcc/d/dmd/ast_node.h
index 6154c6d1b3a..a24218a86d0 100644
--- a/gcc/d/dmd/ast_node.h
+++ b/gcc/d/dmd/ast_node.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/astenums.d b/gcc/d/dmd/astenums.d
index 6a9c0104a72..f19edb9e4b4 100644
--- a/gcc/d/dmd/astenums.d
+++ b/gcc/d/dmd/astenums.d
@@ -1,7 +1,7 @@ 
 /**
  * Defines enums common to dmd and dmd as parse library.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/astenums.d, _astenums.d)
  * Documentation:  https://dlang.org/phobos/dmd_astenums.html
@@ -63,7 +63,7 @@  enum STC : ulong  // transfer changes to declaration.h
     foreach_            = 0x4000,   /// variable for foreach loop
     variadic            = 0x8000,   /// the `variadic` parameter in: T foo(T a, U b, V variadic...)
 
-    //                  = 0x1_0000,
+    constscoperef       = 0x1_0000,   /// when `in` means const|scope|ref
     templateparameter   = 0x2_0000,   /// template parameter
     ref_                = 0x4_0000,   /// `ref`
     scope_              = 0x8_0000,   /// `scope`
@@ -112,7 +112,7 @@  enum STC : ulong  // transfer changes to declaration.h
     volatile_           = 0x40_0000_0000_0000,   /// destined for volatile in the back end
 
     safeGroup = STC.safe | STC.trusted | STC.system,
-    IOR  = STC.in_ | STC.ref_ | STC.out_,
+    IOR  = STC.constscoperef | STC.in_ | STC.ref_ | STC.out_,
     TYPECTOR = (STC.const_ | STC.immutable_ | STC.shared_ | STC.wild),
     FUNCATTR = (STC.ref_ | STC.nothrow_ | STC.nogc | STC.pure_ | STC.property | STC.live |
                 safeGroup),
diff --git a/gcc/d/dmd/attrib.d b/gcc/d/dmd/attrib.d
index cc6ef9c431b..d7d3eca6f8d 100644
--- a/gcc/d/dmd/attrib.d
+++ b/gcc/d/dmd/attrib.d
@@ -14,7 +14,7 @@ 
  * - Protection (`private`, `public`)
  * - Deprecated declarations (`@deprecated`)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/attrib.d, _attrib.d)
@@ -137,7 +137,7 @@  extern (C++) abstract class AttribDeclaration : Dsymbol
         return "attribute";
     }
 
-    override bool oneMember(Dsymbol* ps, Identifier ident)
+    override bool oneMember(out Dsymbol ps, Identifier ident)
     {
         Dsymbols* d = include(null);
         return Dsymbol.oneMembers(d, ps, ident);
@@ -225,10 +225,10 @@  extern (C++) class StorageClassDeclaration : AttribDeclaration
             sc.visibility, sc.explicitVisibility, sc.aligndecl, sc.inlining);
     }
 
-    override final bool oneMember(Dsymbol* ps, Identifier ident)
+    override final bool oneMember(out Dsymbol ps, Identifier ident)
     {
         bool t = Dsymbol.oneMembers(decl, ps, ident);
-        if (t && *ps)
+        if (t && ps)
         {
             /* This is to deal with the following case:
              * struct Tick {
@@ -238,7 +238,7 @@  extern (C++) class StorageClassDeclaration : AttribDeclaration
              * before the semantic analysis of 'to', so that template overloading based on the
              * 'this' pointer can be successful.
              */
-            FuncDeclaration fd = (*ps).isFuncDeclaration();
+            FuncDeclaration fd = ps.isFuncDeclaration();
             if (fd)
             {
                 /* Use storage_class2 instead of storage_class otherwise when we do .di generation
@@ -743,7 +743,7 @@  extern (C++) class ConditionalDeclaration : AttribDeclaration
         return new ConditionalDeclaration(loc, condition.syntaxCopy(), Dsymbol.arraySyntaxCopy(decl), Dsymbol.arraySyntaxCopy(elsedecl));
     }
 
-    override final bool oneMember(Dsymbol* ps, Identifier ident)
+    override final bool oneMember(out Dsymbol ps, Identifier ident)
     {
         //printf("ConditionalDeclaration::oneMember(), inc = %d\n", condition.inc);
         if (condition.inc != Include.notComputed)
@@ -753,8 +753,8 @@  extern (C++) class ConditionalDeclaration : AttribDeclaration
         }
         else
         {
-            bool res = (Dsymbol.oneMembers(decl, ps, ident) && *ps is null && Dsymbol.oneMembers(elsedecl, ps, ident) && *ps is null);
-            *ps = null;
+            bool res = (Dsymbol.oneMembers(decl, ps, ident) && ps is null && Dsymbol.oneMembers(elsedecl, ps, ident) && ps is null);
+            ps = null;
             return res;
         }
     }
@@ -901,7 +901,7 @@  extern (C++) final class StaticForeachDeclaration : AttribDeclaration
             Dsymbol.arraySyntaxCopy(decl));
     }
 
-    override bool oneMember(Dsymbol* ps, Identifier ident)
+    override bool oneMember(out Dsymbol ps, Identifier ident)
     {
         // Required to support IFTI on a template that contains a
         // `static foreach` declaration.  `super.oneMember` calls
@@ -912,7 +912,7 @@  extern (C++) final class StaticForeachDeclaration : AttribDeclaration
         {
             return super.oneMember(ps, ident);
         }
-        *ps = null; // a `static foreach` declaration may in general expand to multiple symbols
+        ps = null; // a `static foreach` declaration may in general expand to multiple symbols
         return false;
     }
 
@@ -1296,3 +1296,27 @@  int foreachUdaNoSemantic(Dsymbol sym, int delegate(Expression) dg)
 
     return 0;
 }
+
+
+/**
+ * Returns: true if the given expression is an enum from `core.attribute` named `id`
+ */
+bool isEnumAttribute(Expression e, Identifier id)
+{
+    import dmd.attrib : isCoreUda;
+    import dmd.id : Id;
+
+    // Logic based on dmd.objc.Supported.declaredAsOptionalCount
+    auto typeExp = e.isTypeExp;
+    if (!typeExp)
+        return false;
+
+    auto typeEnum = typeExp.type.isTypeEnum();
+    if (!typeEnum)
+        return false;
+
+    if (isCoreUda(typeEnum.sym, id))
+        return true;
+
+    return false;
+}
diff --git a/gcc/d/dmd/attrib.h b/gcc/d/dmd/attrib.h
index 35628e26105..344a7e929a7 100644
--- a/gcc/d/dmd/attrib.h
+++ b/gcc/d/dmd/attrib.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
@@ -28,7 +28,7 @@  public:
     virtual Scope *newScope(Scope *sc);
     void addComment(const utf8_t *comment) override;
     const char *kind() const override;
-    bool oneMember(Dsymbol **ps, Identifier *ident) override;
+    bool oneMember(Dsymbol *&ps, Identifier *ident) override;
     bool hasPointers() override final;
     bool hasStaticCtorOrDtor() override final;
     void checkCtorConstInit() override final;
@@ -44,7 +44,7 @@  public:
 
     StorageClassDeclaration *syntaxCopy(Dsymbol *s) override;
     Scope *newScope(Scope *sc) override;
-    bool oneMember(Dsymbol **ps, Identifier *ident) override final;
+    bool oneMember(Dsymbol *&ps, Identifier *ident) override final;
     StorageClassDeclaration *isStorageClassDeclaration() override { return this; }
 
     void accept(Visitor *v) override { v->visit(this); }
@@ -153,7 +153,7 @@  public:
     Dsymbols *elsedecl; // array of Dsymbol's for else block
 
     ConditionalDeclaration *syntaxCopy(Dsymbol *s) override;
-    bool oneMember(Dsymbol **ps, Identifier *ident) override final;
+    bool oneMember(Dsymbol *&ps, Identifier *ident) override final;
     Dsymbols *include(Scope *sc) override;
     void addComment(const utf8_t *comment) override final;
     void accept(Visitor *v) override { v->visit(this); }
@@ -183,7 +183,7 @@  public:
     Dsymbols *cache;
 
     StaticForeachDeclaration *syntaxCopy(Dsymbol *s) override;
-    bool oneMember(Dsymbol **ps, Identifier *ident) override;
+    bool oneMember(Dsymbol *&ps, Identifier *ident) override;
     Dsymbols *include(Scope *sc) override;
     void addComment(const utf8_t *comment) override;
     const char *kind() const override;
diff --git a/gcc/d/dmd/blockexit.d b/gcc/d/dmd/blockexit.d
index 5108ecf7ba7..d77af7e1c5c 100644
--- a/gcc/d/dmd/blockexit.d
+++ b/gcc/d/dmd/blockexit.d
@@ -1,7 +1,7 @@ 
 /**
  * Find out in what ways control flow can exit a statement block.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/blockexit.d, _blockexit.d)
diff --git a/gcc/d/dmd/builtin.d b/gcc/d/dmd/builtin.d
index 27ba1e03454..d29092b6903 100644
--- a/gcc/d/dmd/builtin.d
+++ b/gcc/d/dmd/builtin.d
@@ -3,7 +3,7 @@ 
  *
  * Currently includes functions from `std.math`, `core.math` and `core.bitop`.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/builtin.d, _builtin.d)
diff --git a/gcc/d/dmd/canthrow.d b/gcc/d/dmd/canthrow.d
index 5a608a9986d..31155f188dc 100644
--- a/gcc/d/dmd/canthrow.d
+++ b/gcc/d/dmd/canthrow.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/function.html#nothrow-functions, Nothrow Functions)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/canthrow.d, _canthrow.d)
diff --git a/gcc/d/dmd/chkformat.d b/gcc/d/dmd/chkformat.d
index 8cfad5916c7..5024f9bb210 100644
--- a/gcc/d/dmd/chkformat.d
+++ b/gcc/d/dmd/chkformat.d
@@ -1,7 +1,7 @@ 
 /**
  * Check the arguments to `printf` and `scanf` against the `format` string.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/chkformat.d, _chkformat.d)
diff --git a/gcc/d/dmd/clone.d b/gcc/d/dmd/clone.d
index ca7f398ae7a..6fbf8e284de 100644
--- a/gcc/d/dmd/clone.d
+++ b/gcc/d/dmd/clone.d
@@ -2,7 +2,7 @@ 
  * Builds struct member functions if needed and not defined by the user.
  * Includes `opEquals`, `opAssign`, post blit, copy constructor and destructor.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/clone.d, _clone.d)
@@ -1571,7 +1571,7 @@  private Statement generateCopyCtorBody(StructDeclaration sd)
  *  `true` if one needs to be generated
  *  `false` otherwise
  */
-private bool needCopyCtor(StructDeclaration sd, out bool hasCpCtor)
+bool needCopyCtor(StructDeclaration sd, out bool hasCpCtor)
 {
     if (global.errors)
         return false;
diff --git a/gcc/d/dmd/common/bitfields.d b/gcc/d/dmd/common/bitfields.d
index b9fcb0995c9..01aa56d1809 100644
--- a/gcc/d/dmd/common/bitfields.d
+++ b/gcc/d/dmd/common/bitfields.d
@@ -1,7 +1,7 @@ 
 /**
  * A library bitfields utility
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:   Dennis Korpel
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/common/bitfields.d, common/bitfields.d)
diff --git a/gcc/d/dmd/common/file.d b/gcc/d/dmd/common/file.d
index 704110f50bd..8a284241fc2 100644
--- a/gcc/d/dmd/common/file.d
+++ b/gcc/d/dmd/common/file.d
@@ -4,7 +4,7 @@ 
  * Functions and objects dedicated to file I/O and management. TODO: Move here artifacts
  * from places such as root/ so both the frontend and the backend have access to them.
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:   Walter Bright, https://www.digitalmars.com
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/common/file.d, common/_file.d)
diff --git a/gcc/d/dmd/common/outbuffer.d b/gcc/d/dmd/common/outbuffer.d
index 4e7a82fb565..cff08ec5d43 100644
--- a/gcc/d/dmd/common/outbuffer.d
+++ b/gcc/d/dmd/common/outbuffer.d
@@ -1,7 +1,7 @@ 
 /**
  * An expandable buffer in which you can write text or binary data.
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:   Walter Bright, https://www.digitalmars.com
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/outbuffer.d, root/_outbuffer.d)
diff --git a/gcc/d/dmd/common/outbuffer.h b/gcc/d/dmd/common/outbuffer.h
index 4c1dceea3f6..2250497c38f 100644
--- a/gcc/d/dmd/common/outbuffer.h
+++ b/gcc/d/dmd/common/outbuffer.h
@@ -1,5 +1,5 @@ 
 
-/* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+/* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/common/smallbuffer.d b/gcc/d/dmd/common/smallbuffer.d
index ec0eaae647f..c6aa7abbc60 100644
--- a/gcc/d/dmd/common/smallbuffer.d
+++ b/gcc/d/dmd/common/smallbuffer.d
@@ -1,7 +1,7 @@ 
 /**
  * Common string functions including filename manipulation.
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:   Walter Bright, https://www.digitalmars.com
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/common/smallbuffer.d, common/_smallbuffer.d)
@@ -48,7 +48,7 @@  struct SmallBuffer(Element)
         }
         else
         {
-            assert(len < sizeof.max / (2 * Element.sizeof));
+            assert(len < size_t.max / (2 * Element.sizeof));
             _extent = (cast(typeof(_extent.ptr)) malloc(len * Element.sizeof))[0 .. len];
             _extent.ptr || assert(0, "Out of memory.");
             needsFree = true;
@@ -76,7 +76,7 @@  struct SmallBuffer(Element)
         else
         {
             __dtor();
-            assert(len < sizeof.max / Element.sizeof);
+            assert(len < size_t.max / Element.sizeof);
             _extent = (cast(typeof(_extent.ptr)) malloc(len * Element.sizeof))[0 .. len];
             _extent.ptr || assert(0, "Out of memory.");
             needsFree = true;
diff --git a/gcc/d/dmd/compiler.d b/gcc/d/dmd/compiler.d
index 8b8a453d45e..65330cf5d11 100644
--- a/gcc/d/dmd/compiler.d
+++ b/gcc/d/dmd/compiler.d
@@ -1,7 +1,7 @@ 
 /**
  * Describes a back-end compiler and implements compiler-specific actions.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/compiler.d, _compiler.d)
diff --git a/gcc/d/dmd/compiler.h b/gcc/d/dmd/compiler.h
index c7cbce3bd7f..74351edb449 100644
--- a/gcc/d/dmd/compiler.h
+++ b/gcc/d/dmd/compiler.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/cond.d b/gcc/d/dmd/cond.d
index 568b639e0b6..1b32ff774c8 100644
--- a/gcc/d/dmd/cond.d
+++ b/gcc/d/dmd/cond.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/version.html, Conditional Compilation)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/cond.d, _cond.d)
diff --git a/gcc/d/dmd/cond.h b/gcc/d/dmd/cond.h
index d02ae1321c5..fe497c2da7e 100644
--- a/gcc/d/dmd/cond.h
+++ b/gcc/d/dmd/cond.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/constfold.d b/gcc/d/dmd/constfold.d
index fc3fd3b2486..7bd9691a429 100644
--- a/gcc/d/dmd/constfold.d
+++ b/gcc/d/dmd/constfold.d
@@ -5,7 +5,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/float.html#fp_const_folding, Floating Point Constant Folding)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/constfold.d, _constfold.d)
diff --git a/gcc/d/dmd/cparse.d b/gcc/d/dmd/cparse.d
index 4c0b96a4c8c..e0cdc87b7fd 100644
--- a/gcc/d/dmd/cparse.d
+++ b/gcc/d/dmd/cparse.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: C11
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/cparse.d, _cparse.d)
@@ -605,15 +605,23 @@  final class CParser(AST) : Parser!AST
         {
             Identifier ident;
             nextToken();
-            if (token.value != TOK.identifier)
+            if (token.value == TOK.identifier)
             {
-                error("identifier expected following `goto`");
+                ident = token.ident;
+                nextToken();
+            }
+            else if (token.value == TOK.mul)
+            {
+                /* https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
+                 */
+                error("`goto *` computed goto extension is not supported");
                 ident = null;
+                cparseUnaryExp();   // parse and throw away
             }
             else
             {
-                ident = token.ident;
-                nextToken();
+                error("identifier expected following `goto`");
+                ident = null;
             }
             s = new AST.GotoStatement(loc, ident);
             check(TOK.semicolon, "`goto` statement");
@@ -1056,6 +1064,14 @@  final class CParser(AST) : Parser!AST
             break;
         }
 
+        case TOK.andAnd:
+            /* https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
+             */
+            error("unary `&&` computed goto extension is not supported");
+            nextToken();
+            e = cparseCastExp();
+            break;
+
         case TOK._Alignof:
         {
             nextToken();
@@ -1931,20 +1947,18 @@  final class CParser(AST) : Parser!AST
                 }
                 else if (auto tt = dt.isTypeTag())
                 {
-                    if (tt.id || tt.tok == TOK.enum_)
-                    {
-                        if (!tt.id && id)
-                            /* This applies for enums declared as
-                             * typedef enum {A} E;
-                             */
-                            tt.id = id;
-                        Specifier spec;
-                        declareTag(tt, spec);
-                    }
+                    if (!tt.id && id)
+                        /* This applies for enums declared as
+                         * typedef enum {A} E;
+                         */
+                        tt.id = id;
+                    Specifier spec;
+                    declareTag(tt, spec);
                     idt = tt.id;
                 }
                 if (isalias)
                 {
+                    //printf("AliasDeclaration %s %s\n", id.toChars(), dt.toChars());
                     auto ad = new AST.AliasDeclaration(token.loc, id, dt);
                     if (id == idt)
                         ad.adFlags |= ad.hidden; // do not print when generating .di files
diff --git a/gcc/d/dmd/cppmangle.d b/gcc/d/dmd/cppmangle.d
index 55844ddf606..90b6295ab2f 100644
--- a/gcc/d/dmd/cppmangle.d
+++ b/gcc/d/dmd/cppmangle.d
@@ -4,7 +4,7 @@ 
  * This is the POSIX side of the implementation.
  * It exports two functions to C++, `toCppMangleItanium` and `cppTypeInfoMangleItanium`.
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors: Walter Bright, https://www.digitalmars.com
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/cppmangle.d, _cppmangle.d)
diff --git a/gcc/d/dmd/ctfe.h b/gcc/d/dmd/ctfe.h
index bb92778e253..72d895c7150 100644
--- a/gcc/d/dmd/ctfe.h
+++ b/gcc/d/dmd/ctfe.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/ctfeexpr.d b/gcc/d/dmd/ctfeexpr.d
index 993bab023f9..5fe1e7dccb0 100644
--- a/gcc/d/dmd/ctfeexpr.d
+++ b/gcc/d/dmd/ctfeexpr.d
@@ -1,7 +1,7 @@ 
 /**
  * CTFE for expressions involving pointers, slices, array concatenation etc.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/ctfeexpr.d, _ctfeexpr.d)
diff --git a/gcc/d/dmd/ctorflow.d b/gcc/d/dmd/ctorflow.d
index 128c698ab87..ba5240e5e10 100644
--- a/gcc/d/dmd/ctorflow.d
+++ b/gcc/d/dmd/ctorflow.d
@@ -1,7 +1,7 @@ 
 /**
  * Manage flow analysis for constructors.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/ctorflow.d, _ctorflow.d)
diff --git a/gcc/d/dmd/dcast.d b/gcc/d/dmd/dcast.d
index cfa374c970b..628c688979f 100644
--- a/gcc/d/dmd/dcast.d
+++ b/gcc/d/dmd/dcast.d
@@ -1,7 +1,7 @@ 
 /**
  * Semantic analysis for cast-expressions.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dcast.d, _dcast.d)
diff --git a/gcc/d/dmd/dclass.d b/gcc/d/dmd/dclass.d
index e066d877e8a..405e8170b2c 100644
--- a/gcc/d/dmd/dclass.d
+++ b/gcc/d/dmd/dclass.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/class.html, Classes)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dclass.d, _dclass.d)
diff --git a/gcc/d/dmd/declaration.d b/gcc/d/dmd/declaration.d
index bdc91f4f1f2..5869a220842 100644
--- a/gcc/d/dmd/declaration.d
+++ b/gcc/d/dmd/declaration.d
@@ -2,7 +2,7 @@ 
  * Miscellaneous declarations, including typedef, alias, variable declarations including the
  * implicit this declaration, type tuples, ClassInfo, ModuleInfo and various TypeInfos.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/declaration.d, _declaration.d)
@@ -246,8 +246,6 @@  extern (C++) abstract class Declaration : Dsymbol
       enum nounderscore = 4; // don't prepend _ to mangled name
       enum hidden       = 8; // don't print this in .di files
 
-    Symbol* isym;           // import version of csym
-
     // overridden symbol with pragma(mangle, "...")
     const(char)[] mangleOverride;
 
diff --git a/gcc/d/dmd/declaration.h b/gcc/d/dmd/declaration.h
index adbc26bf570..0e327bedfbd 100644
--- a/gcc/d/dmd/declaration.h
+++ b/gcc/d/dmd/declaration.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
@@ -54,7 +54,7 @@  struct AttributeViolation;
     #define STCforeach            0x4000ULL    /// variable for foreach loop
     #define STCvariadic           0x8000ULL    /// the `variadic` parameter in: T foo(T a, U b, V variadic...)
 
-    //                            0x10000ULL
+    #define STCconstscoperef      0x10000ULL    /// when `in` means const|scope|ref
     #define STCtemplateparameter  0x20000ULL    /// template parameter
     #define STCref                0x40000ULL    /// `ref`
     #define STCscope              0x80000ULL    /// `scope`
@@ -118,7 +118,6 @@  public:
     LINK _linkage;              // may be `LINK::system`; use `resolvedLinkage()` to resolve it
     short inuse;                // used to detect cycles
     uint8_t adFlags;
-    Symbol* isym;               // import version of csym
     DString mangleOverride;     // overridden symbol with pragma(mangle, "...")
 
     const char *kind() const override;
@@ -843,6 +842,7 @@  public:
 class SharedStaticCtorDeclaration final : public StaticCtorDeclaration
 {
 public:
+    bool standalone;
     SharedStaticCtorDeclaration *syntaxCopy(Dsymbol *) override;
 
     SharedStaticCtorDeclaration *isSharedStaticCtorDeclaration() override { return this; }
diff --git a/gcc/d/dmd/delegatize.d b/gcc/d/dmd/delegatize.d
index 490ef56646f..62800d3fdb7 100644
--- a/gcc/d/dmd/delegatize.d
+++ b/gcc/d/dmd/delegatize.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/function.html#lazy-params, Lazy Parameters)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/delegatize.d, _delegatize.d)
diff --git a/gcc/d/dmd/denum.d b/gcc/d/dmd/denum.d
index 5713be1e99e..5464ff99f58 100644
--- a/gcc/d/dmd/denum.d
+++ b/gcc/d/dmd/denum.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/enum.html, Enums)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/denum.d, _denum.d)
@@ -83,7 +83,7 @@  extern (C++) final class EnumDeclaration : ScopeDsymbol
         return ed;
     }
 
-    override bool oneMember(Dsymbol* ps, Identifier ident)
+    override bool oneMember(out Dsymbol ps, Identifier ident)
     {
         if (isAnonymous())
             return Dsymbol.oneMembers(members, ps, ident);
diff --git a/gcc/d/dmd/dimport.d b/gcc/d/dmd/dimport.d
index 51b9220c185..b083c03aebe 100644
--- a/gcc/d/dmd/dimport.d
+++ b/gcc/d/dmd/dimport.d
@@ -1,7 +1,7 @@ 
 /**
  * A `Dsymbol` representing a renamed import.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dimport.d, _dimport.d)
diff --git a/gcc/d/dmd/dinterpret.d b/gcc/d/dmd/dinterpret.d
index 90352e32bea..eda91d1ea05 100644
--- a/gcc/d/dmd/dinterpret.d
+++ b/gcc/d/dmd/dinterpret.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: ($LINK2 https://dlang.org/spec/function.html#interpretation, Compile Time Function Execution (CTFE))
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dinterpret.d, _dinterpret.d)
diff --git a/gcc/d/dmd/dmacro.d b/gcc/d/dmd/dmacro.d
index 6e6c4b17e99..c04fbec731d 100644
--- a/gcc/d/dmd/dmacro.d
+++ b/gcc/d/dmd/dmacro.d
@@ -1,7 +1,7 @@ 
 /**
  * Text macro processor for Ddoc.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dmacro.d, _dmacro.d)
diff --git a/gcc/d/dmd/dmangle.d b/gcc/d/dmd/dmangle.d
index 2bedccb71c1..15b77eaac4c 100644
--- a/gcc/d/dmd/dmangle.d
+++ b/gcc/d/dmd/dmangle.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/abi.html#name_mangling, Name Mangling)
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors: Walter Bright, https://www.digitalmars.com
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dmangle.d, _dmangle.d)
@@ -528,7 +528,7 @@  void mangleParameter(Parameter p, ref OutBuffer buf, ref Backref backref)
     if (stc & STC.return_)
         buf.writestring("Nk"); // return
 
-    switch (stc & (STC.IOR | STC.lazy_))
+    switch (stc & ((STC.IOR | STC.lazy_) & ~STC.constscoperef))
     {
     case 0:
         break;
diff --git a/gcc/d/dmd/dmodule.d b/gcc/d/dmd/dmodule.d
index 6c9e90a2c8f..022231c1254 100644
--- a/gcc/d/dmd/dmodule.d
+++ b/gcc/d/dmd/dmodule.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/module.html, Modules)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dmodule.d, _dmodule.d)
diff --git a/gcc/d/dmd/doc.d b/gcc/d/dmd/doc.d
index 03848c0274b..810642f9f52 100644
--- a/gcc/d/dmd/doc.d
+++ b/gcc/d/dmd/doc.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/ddoc.html, Documentation Generator)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/doc.d, _doc.d)
@@ -1296,7 +1296,7 @@  void toDocBuffer(Dsymbol s, ref OutBuffer buf, Scope* sc)
                 Type origType = d.originalType ? d.originalType : d.type;
                 if (origType.ty == Tfunction)
                 {
-                    functionToBufferFull(cast(TypeFunction)origType, *buf, d.ident, &hgs, td);
+                    functionToBufferFull(cast(TypeFunction)origType, *buf, d.ident, hgs, td);
                 }
                 else
                     toCBuffer(origType, *buf, d.ident, hgs);
diff --git a/gcc/d/dmd/doc.h b/gcc/d/dmd/doc.h
index ebd3094348d..71a66b90cb8 100644
--- a/gcc/d/dmd/doc.h
+++ b/gcc/d/dmd/doc.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/dscope.d b/gcc/d/dmd/dscope.d
index cd177a66f50..7e9499fd28f 100644
--- a/gcc/d/dmd/dscope.d
+++ b/gcc/d/dmd/dscope.d
@@ -3,7 +3,7 @@ 
  *
  * Not to be confused with the `scope` storage class.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dscope.d, _dscope.d)
diff --git a/gcc/d/dmd/dstruct.d b/gcc/d/dmd/dstruct.d
index 0e0a1f52f88..5683d5fb1d5 100644
--- a/gcc/d/dmd/dstruct.d
+++ b/gcc/d/dmd/dstruct.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/struct.html, Structs, Unions)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dstruct.d, _dstruct.d)
@@ -434,7 +434,11 @@  extern (C++) class StructDeclaration : AggregateDeclaration
 
         ispod = ThreeState.yes;
 
-        if (enclosing || postblit || dtor || hasCopyCtor)
+        import dmd.clone;
+        bool hasCpCtorLocal;
+        needCopyCtor(this, hasCpCtorLocal);
+
+        if (enclosing || search(this, loc, Id.postblit) || search(this, loc, Id.dtor) || hasCpCtorLocal)
         {
             ispod = ThreeState.no;
             return false;
diff --git a/gcc/d/dmd/dsymbol.d b/gcc/d/dmd/dsymbol.d
index 6613c2bc5c2..5e7922ea11d 100644
--- a/gcc/d/dmd/dsymbol.d
+++ b/gcc/d/dmd/dsymbol.d
@@ -1,7 +1,7 @@ 
 /**
  * The base class for a D symbol, which can be a module, variable, function, enum, etc.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dsymbol.d, _dsymbol.d)
@@ -845,27 +845,27 @@  extern (C++) class Dsymbol : ASTNode
     /**************************************
      * Determine if this symbol is only one.
      * Returns:
-     *      false, *ps = NULL: There are 2 or more symbols
-     *      true,  *ps = NULL: There are zero symbols
-     *      true,  *ps = symbol: The one and only one symbol
+     *      false, ps = null: There are 2 or more symbols
+     *      true,  ps = null: There are zero symbols
+     *      true,  ps = symbol: The one and only one symbol
      */
-    bool oneMember(Dsymbol* ps, Identifier ident)
+    bool oneMember(out Dsymbol ps, Identifier ident)
     {
         //printf("Dsymbol::oneMember()\n");
-        *ps = this;
+        ps = this;
         return true;
     }
 
     /*****************************************
      * Same as Dsymbol::oneMember(), but look at an array of Dsymbols.
      */
-    extern (D) static bool oneMembers(Dsymbols* members, Dsymbol* ps, Identifier ident)
+    extern (D) static bool oneMembers(Dsymbols* members, out Dsymbol ps, Identifier ident)
     {
         //printf("Dsymbol::oneMembers() %d\n", members ? members.length : 0);
         Dsymbol s = null;
         if (!members)
         {
-            *ps = null;
+            ps = null;
             return true;
         }
 
@@ -877,21 +877,21 @@  extern (C++) class Dsymbol : ASTNode
             if (!x)
             {
                 //printf("\tfalse 1\n");
-                assert(*ps is null);
+                assert(ps is null);
                 return false;
             }
-            if (*ps)
+            if (ps)
             {
                 assert(ident);
-                if (!(*ps).ident || !(*ps).ident.equals(ident))
+                if (!ps.ident || !ps.ident.equals(ident))
                     continue;
                 if (!s)
-                    s = *ps;
-                else if (s.isOverloadable() && (*ps).isOverloadable())
+                    s = ps;
+                else if (s.isOverloadable() && ps.isOverloadable())
                 {
                     // keep head of overload set
                     FuncDeclaration f1 = s.isFuncDeclaration();
-                    FuncDeclaration f2 = (*ps).isFuncDeclaration();
+                    FuncDeclaration f2 = ps.isFuncDeclaration();
                     if (f1 && f2)
                     {
                         assert(!f1.isFuncAliasDeclaration());
@@ -908,13 +908,13 @@  extern (C++) class Dsymbol : ASTNode
                 }
                 else // more than one symbol
                 {
-                    *ps = null;
+                    ps = null;
                     //printf("\tfalse 2\n");
                     return false;
                 }
             }
         }
-        *ps = s; // s is the one symbol, null if none
+        ps = s; // s is the one symbol, null if none
         //printf("\ttrue\n");
         return true;
     }
diff --git a/gcc/d/dmd/dsymbol.h b/gcc/d/dmd/dsymbol.h
index d029c00fc1c..7d715b47b31 100644
--- a/gcc/d/dmd/dsymbol.h
+++ b/gcc/d/dmd/dsymbol.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
@@ -246,7 +246,7 @@  public:
     virtual bool needThis();                    // need a 'this' pointer?
     virtual Visibility visible();
     virtual Dsymbol *syntaxCopy(Dsymbol *s);    // copy only syntax trees
-    virtual bool oneMember(Dsymbol **ps, Identifier *ident);
+    virtual bool oneMember(Dsymbol *&ps, Identifier *ident);
     virtual bool hasPointers();
     virtual bool hasStaticCtorOrDtor();
     virtual void addObjcSymbols(ClassDeclarations *, ClassDeclarations *) { }
diff --git a/gcc/d/dmd/dsymbolsem.d b/gcc/d/dmd/dsymbolsem.d
index df0a9a536f4..23f0bc5b428 100644
--- a/gcc/d/dmd/dsymbolsem.d
+++ b/gcc/d/dmd/dsymbolsem.d
@@ -2,7 +2,7 @@ 
  * Does the semantic 1 pass on the AST, which looks at symbol declarations but not initializers
  * or function bodies.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dsymbolsem.d, _dsymbolsem.d)
@@ -947,7 +947,7 @@  private extern(C++) final class DsymbolSemanticVisitor : Visitor
 
         // At this point we can add `scope` to the STC instead of `in`,
         // because we are never going to use this variable's STC for user messages
-        if (dsym.storage_class & STC.in_ && global.params.previewIn)
+        if (dsym.storage_class & STC.constscoperef)
             dsym.storage_class |= STC.scope_;
 
         if (dsym.storage_class & STC.scope_)
@@ -2964,7 +2964,7 @@  private extern(C++) final class DsymbolSemanticVisitor : Visitor
         if (tempdecl.members)
         {
             Dsymbol s;
-            if (Dsymbol.oneMembers(tempdecl.members, &s, tempdecl.ident) && s)
+            if (Dsymbol.oneMembers(tempdecl.members, s, tempdecl.ident) && s)
             {
                 tempdecl.onemember = s;
                 s.parent = tempdecl;
@@ -4096,7 +4096,7 @@  private extern(C++) final class DsymbolSemanticVisitor : Visitor
 
                     auto fd = s.isFuncDeclaration();
                     functionToBufferFull(cast(TypeFunction)(funcdecl.type), buf,
-                        new Identifier(funcdecl.toPrettyChars()), &hgs, null);
+                        new Identifier(funcdecl.toPrettyChars()), hgs, null);
                     const(char)* funcdeclToChars = buf.peekChars();
 
                     if (fd)
@@ -4119,7 +4119,7 @@  private extern(C++) final class DsymbolSemanticVisitor : Visitor
                         else
                         {
                             functionToBufferFull(cast(TypeFunction)(fd.type), buf1,
-                                new Identifier(fd.toPrettyChars()), &hgs, null);
+                                new Identifier(fd.toPrettyChars()), hgs, null);
 
                             error(funcdecl.loc, "function `%s` does not override any function, did you mean to override `%s`?",
                                 funcdeclToChars, buf1.peekChars());
@@ -4592,6 +4592,24 @@  private extern(C++) final class DsymbolSemanticVisitor : Visitor
             m.needmoduleinfo = 1;
             //printf("module1 %s needs moduleinfo\n", m.toChars());
         }
+
+        foreachUda(scd, sc, (Expression e) {
+            import dmd.attrib : isEnumAttribute;
+            if (!isEnumAttribute(e, Id.udaStandalone))
+                return 0;
+
+            if (auto sharedCtor = scd.isSharedStaticCtorDeclaration())
+            {
+                auto trust = sharedCtor.type.isTypeFunction().trust;
+                if (trust != TRUST.system && trust != TRUST.trusted)
+                    error(e.loc, "a module constructor using `@%s` must be `@system` or `@trusted`", Id.udaStandalone.toChars());
+                sharedCtor.standalone = true;
+            }
+            else
+                .error(e.loc, "`@%s` can only be used on shared static constructors", Id.udaStandalone.toChars());
+
+            return 1;
+        });
     }
 
     override void visit(StaticDtorDeclaration sdd)
@@ -4831,9 +4849,15 @@  private extern(C++) final class DsymbolSemanticVisitor : Visitor
         {
             if (ts.sym != sd)
             {
-                auto ti = ts.sym.isInstantiated();
+                TemplateInstance ti = ts.sym.isInstantiated();
                 if (ti && isError(ti))
                     ts.sym = sd;
+                /* For C modules, if module A contains `struct S;` and
+                 * module B contains `struct S { members...}` then replace
+                 * the former with the latter
+                 */
+                else if (!ts.sym.members && sd.members)
+                    ts.sym = sd;
             }
         }
 
@@ -5357,7 +5381,7 @@  private extern(C++) final class DsymbolSemanticVisitor : Visitor
                     cldec.classKind = ClassKind.cpp;
                 if (cldec.classKind != cldec.baseClass.classKind)
                     .error(cldec.loc, "%s `%s` with %s linkage cannot inherit from class `%s` with %s linkage", cldec.kind, cldec.toPrettyChars,
-                        cldec.classKind.toChars(), cldec.baseClass.toChars(), cldec.baseClass.classKind.toChars());
+                        ClassKindToChars(cldec.classKind), cldec.baseClass.toChars(), ClassKindToChars(cldec.baseClass.classKind));
 
                 if (cldec.baseClass.stack)
                     cldec.stack = true;
@@ -6807,7 +6831,7 @@  void templateInstanceSemantic(TemplateInstance tempinst, Scope* sc, ArgumentList
     if (tempinst.members.length)
     {
         Dsymbol s;
-        if (Dsymbol.oneMembers(tempinst.members, &s, tempdecl.ident) && s)
+        if (Dsymbol.oneMembers(tempinst.members, s, tempdecl.ident) && s)
         {
             //printf("tempdecl.ident = %s, s = `%s %s`\n", tempdecl.ident.toChars(), s.kind(), s.toPrettyChars());
             //printf("setting aliasdecl\n");
@@ -6852,7 +6876,7 @@  void templateInstanceSemantic(TemplateInstance tempinst, Scope* sc, ArgumentList
     if (tempinst.members.length)
     {
         Dsymbol s;
-        if (Dsymbol.oneMembers(tempinst.members, &s, tempdecl.ident) && s)
+        if (Dsymbol.oneMembers(tempinst.members, s, tempdecl.ident) && s)
         {
             if (!tempinst.aliasdecl || tempinst.aliasdecl != s)
             {
diff --git a/gcc/d/dmd/dtemplate.d b/gcc/d/dmd/dtemplate.d
index e440b9e2eb6..1d84ccd0295 100644
--- a/gcc/d/dmd/dtemplate.d
+++ b/gcc/d/dmd/dtemplate.d
@@ -28,7 +28,7 @@ 
  *   arguments, and uses it if found.
  * - Otherwise, the rest of semantic is run on the `TemplateInstance`.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dtemplate.d, _dtemplate.d)
@@ -615,7 +615,7 @@  extern (C++) final class TemplateDeclaration : ScopeDsymbol
             return;
 
         Dsymbol s;
-        if (!Dsymbol.oneMembers(members, &s, ident) || !s)
+        if (!Dsymbol.oneMembers(members, s, ident) || !s)
             return;
 
         onemember = s;
@@ -6029,9 +6029,9 @@  extern (C++) class TemplateInstance : ScopeDsymbol
         return "template instance";
     }
 
-    override bool oneMember(Dsymbol* ps, Identifier ident)
+    override bool oneMember(out Dsymbol ps, Identifier ident)
     {
-        *ps = null;
+        ps = null;
         return true;
     }
 
@@ -7599,7 +7599,7 @@  extern (C++) class TemplateInstance : ScopeDsymbol
                 if (members.length)
                 {
                     Dsymbol sa;
-                    if (Dsymbol.oneMembers(members, &sa, tempdecl.ident) && sa)
+                    if (Dsymbol.oneMembers(members, sa, tempdecl.ident) && sa)
                         aliasdecl = sa;
                 }
                 done = true;
@@ -7820,7 +7820,7 @@  extern (C++) final class TemplateMixin : TemplateInstance
         return "mixin";
     }
 
-    override bool oneMember(Dsymbol* ps, Identifier ident)
+    override bool oneMember(out Dsymbol ps, Identifier ident)
     {
         return Dsymbol.oneMember(ps, ident);
     }
diff --git a/gcc/d/dmd/dtoh.d b/gcc/d/dmd/dtoh.d
index ed83a8d9fe1..30991c9171a 100644
--- a/gcc/d/dmd/dtoh.d
+++ b/gcc/d/dmd/dtoh.d
@@ -2,7 +2,7 @@ 
  * This module contains the implementation of the C++ header generation available through
  * the command line switch -Hc.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dtohd, _dtoh.d)
diff --git a/gcc/d/dmd/dversion.d b/gcc/d/dmd/dversion.d
index 31725c80b9b..2e3b35264db 100644
--- a/gcc/d/dmd/dversion.d
+++ b/gcc/d/dmd/dversion.d
@@ -4,7 +4,7 @@ 
  * Specification: $(LINK2 https://dlang.org/spec/version.html#version-specification, Version Specification),
  *                $(LINK2 https://dlang.org/spec/version.html#debug_specification, Debug Specification).
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dversion.d, _dversion.d)
diff --git a/gcc/d/dmd/entity.d b/gcc/d/dmd/entity.d
index c31883f11d9..af74c3bb8d5 100644
--- a/gcc/d/dmd/entity.d
+++ b/gcc/d/dmd/entity.d
@@ -3,7 +3,7 @@ 
  *
  * Specification $(LINK2 https://dlang.org/spec/entity.html, Named Character Entities)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/entity.d, _entity.d)
diff --git a/gcc/d/dmd/enum.h b/gcc/d/dmd/enum.h
index 5f91ead9e17..a4bb588cac6 100644
--- a/gcc/d/dmd/enum.h
+++ b/gcc/d/dmd/enum.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
@@ -46,7 +46,7 @@  public:
     bool inuse(bool v);
 
     EnumDeclaration *syntaxCopy(Dsymbol *s) override;
-    bool oneMember(Dsymbol **ps, Identifier *ident) override;
+    bool oneMember(Dsymbol *&ps, Identifier *ident) override;
     Type *getType() override;
     const char *kind() const override;
     bool isDeprecated() const override;       // is Dsymbol deprecated?
diff --git a/gcc/d/dmd/errors.d b/gcc/d/dmd/errors.d
index 542b97b1ada..79efc6e51aa 100644
--- a/gcc/d/dmd/errors.d
+++ b/gcc/d/dmd/errors.d
@@ -1,7 +1,7 @@ 
 /**
  * Functions for raising errors.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/errors.d, _errors.d)
diff --git a/gcc/d/dmd/errors.h b/gcc/d/dmd/errors.h
index 759ad277fda..308e81e30ba 100644
--- a/gcc/d/dmd/errors.h
+++ b/gcc/d/dmd/errors.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/errorsink.d b/gcc/d/dmd/errorsink.d
index 3811f1d2932..afea689546b 100644
--- a/gcc/d/dmd/errorsink.d
+++ b/gcc/d/dmd/errorsink.d
@@ -1,7 +1,7 @@ 
 /**
  * Provides an abstraction for what to do with error messages.
  *
- * Copyright:   Copyright (C) 2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 2023-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/errorsink.d, _errorsink.d)
diff --git a/gcc/d/dmd/escape.d b/gcc/d/dmd/escape.d
index f928b08503a..433907a17be 100644
--- a/gcc/d/dmd/escape.d
+++ b/gcc/d/dmd/escape.d
@@ -1,7 +1,7 @@ 
 /**
  * Most of the logic to implement scoped pointers and scoped references is here.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/escape.d, _escape.d)
@@ -1296,7 +1296,7 @@  private bool checkReturnEscapeImpl(Scope* sc, Expression e, bool refs, bool gag)
     {
         if (log)
         {
-            printf("byref `%s` %s\n", v.toChars(), toChars(buildScopeRef(v.storage_class)));
+            printf("byref `%s` %s\n", v.toChars(), ScopeRefToChars(buildScopeRef(v.storage_class)));
         }
 
         // 'featureState' tells us whether to emit an error or a deprecation,
diff --git a/gcc/d/dmd/expression.d b/gcc/d/dmd/expression.d
index f51a8b00891..41eeff923d8 100644
--- a/gcc/d/dmd/expression.d
+++ b/gcc/d/dmd/expression.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: ($LINK2 https://dlang.org/spec/expression.html, Expressions)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/expression.d, _expression.d)
@@ -420,10 +420,7 @@  extern (C++) abstract class Expression : ASTNode
 
     override const(char)* toChars() const
     {
-        OutBuffer buf;
-        HdrGenState hgs;
-        toCBuffer(this, buf, hgs);
-        return buf.extractChars();
+        return .toChars(this);
     }
 
     /**********************************
diff --git a/gcc/d/dmd/expression.h b/gcc/d/dmd/expression.h
index b4ace74b496..f57f6a40295 100644
--- a/gcc/d/dmd/expression.h
+++ b/gcc/d/dmd/expression.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
@@ -434,7 +434,7 @@  public:
 
     union
     {
-        Symbol *sym;                // back end symbol to initialize with literal
+        Symbol *sym;                // back end symbol to initialize with literal (used as a Symbol*)
 
         // those fields need to prevent a infinite recursion when one field of struct initialized with 'this' pointer.
         StructLiteralExp *inlinecopy;
diff --git a/gcc/d/dmd/expressionsem.d b/gcc/d/dmd/expressionsem.d
index c21b382c71e..9ce6f4ded9d 100644
--- a/gcc/d/dmd/expressionsem.d
+++ b/gcc/d/dmd/expressionsem.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: ($LINK2 https://dlang.org/spec/expression.html, Expressions)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/expressionsem.d, _expressionsem.d)
@@ -6813,11 +6813,14 @@  private extern (C++) final class ExpressionSemanticVisitor : Visitor
                             {
                                 if (sc.func.fes)
                                 {
-                                    deprecation(e.loc, "%s `%s` is shadowing %s `%s`. Rename the `foreach` variable.", s.kind(), s.ident.toChars(), s2.kind(), s2.toPrettyChars());
+                                    deprecation(e.loc, "%s `%s` is shadowing %s `%s`", s.kind(), s.ident.toChars(), s2.kind(), s2.toPrettyChars());
+                                    deprecationSupplemental(s2.loc, "declared here");
+
                                 }
                                 else
                                 {
                                     error(e.loc, "%s `%s` is shadowing %s `%s`", s.kind(), s.ident.toChars(), s2.kind(), s2.toPrettyChars());
+                                    errorSupplemental(s2.loc, "declared here");
                                     return setError();
                                 }
                             }
@@ -7592,6 +7595,13 @@  private extern (C++) final class ExpressionSemanticVisitor : Visitor
         {
             printf("AssertExp::semantic('%s')\n", exp.toChars());
         }
+        if (auto e = exp.e1.isStringExp())
+        {
+            // deprecated in 2.107
+            deprecation(e.loc, "assert condition cannot be a string literal");
+            deprecationSupplemental(e.loc, "If intentional, use `%s !is null` instead to preserve behaviour",
+                e.toChars());
+        }
 
         const generateMsg = !exp.msg &&
                             sc.needsCodegen() && // let ctfe interpreter handle the error message
@@ -15037,6 +15047,8 @@  bool checkSharedAccess(Expression e, Scope* sc, bool returnRef = false)
  */
 Expression resolveLoc(Expression exp, const ref Loc loc, Scope* sc)
 {
+    exp.loc = loc;
+
     Expression visit(Expression exp)
     {
         if (auto unaExp = exp.isUnaExp())
@@ -15044,7 +15056,6 @@  Expression resolveLoc(Expression exp, const ref Loc loc, Scope* sc)
             unaExp.e1 = unaExp.e1.resolveLoc(loc, sc);
             return unaExp;
         }
-        exp.loc = loc;
         return exp;
     }
 
diff --git a/gcc/d/dmd/file_manager.d b/gcc/d/dmd/file_manager.d
index a0e5d0519c8..eaef8d545e6 100644
--- a/gcc/d/dmd/file_manager.d
+++ b/gcc/d/dmd/file_manager.d
@@ -1,7 +1,7 @@ 
 /**
  * Read a file from disk and store it in memory.
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/file_manager.d, _file_manager.d)
  * Documentation:  https://dlang.org/phobos/dmd_file_manager.html
@@ -10,6 +10,7 @@ 
 
 module dmd.file_manager;
 
+import core.stdc.stdio;
 import dmd.root.stringtable : StringTable;
 import dmd.root.file : File, Buffer;
 import dmd.root.filename : FileName, isDirSeparator;
@@ -281,63 +282,103 @@  nothrow:
         return fb;
     }
 
-    /**
-     * Looks up the given filename from the internal file buffer table, and returns the lines within the file.
-     * If the file does not already exist within the table, it will be read from the filesystem.
-     * If it has been read before,
-     *
-     * Returns: the loaded source file if it was found in memory,
-     *      otherwise `null`
+    /**********************************
+     * Take `text` and turn it into an InputRange that emits
+     * slices into `text` for each line.
+     * Params:
+     *  text = array of characters
+     * Returns:
+     *  InputRange accessing `text` as a sequence of lines
+     * Reference:
+     *  `std.string.splitLines()`
      */
-    const(char)[][] getLines(FileName file)
+    auto splitLines(const char[] text)
     {
-        const(char)[][] lines;
-        if (const buffer = lookup(file))
+        struct Range
         {
-            const slice = buffer;
-            size_t start, end;
-            for (auto i = 0; i < slice.length; i++)
+          @safe:
+          @nogc:
+          nothrow:
+          pure:
+          private:
+
+            const char[] text;
+            size_t index;       // index of start of line
+            size_t eolIndex;    // index of end of line before newline characters
+            size_t nextIndex;   // index past end of line
+
+            public this(const char[] text)
+            {
+                this.text = text;
+            }
+
+            public bool empty() { return index == text.length; }
+
+            public void popFront() { advance(); index = nextIndex; }
+
+            public const(char)[] front() { advance(); return text[index .. eolIndex]; }
+
+            private void advance()
             {
-                const c = slice[i];
-                if (c == '\n' || c == '\r')
+                if (index != nextIndex) // if already advanced
+                    return;
+
+                for (size_t i = index; i < text.length; ++i)
                 {
-                    if (i != 0)
-                    {
-                        end = i;
-                        // Appending lines one at a time will certainly be slow
-                        lines ~= cast(const(char)[])slice[start .. end];
-                    }
-                    // Check for Windows-style CRLF newlines
-                    if (c == '\r')
+                    switch (text[i])
                     {
-                        if (slice.length > i + 1 && slice[i + 1] == '\n')
-                        {
-                            // This is a CRLF sequence, skip over two characters
-                            start = i + 2;
-                            i++;
-                        }
-                        else
-                        {
-                            // Just a CR sequence
-                            start = i + 1;
-                        }
-                    }
-                    else
-                    {
-                        // The next line should start after the LF sequence
-                        start = i + 1;
+                        case '\v', '\f', '\n':
+                            eolIndex = i;
+                            nextIndex = i + 1;
+                            return;
+
+                        case '\r':
+                            if (i + 1 < text.length && text[i + 1] == '\n') // decode "\r\n"
+                            {
+                                eolIndex = i;
+                                nextIndex = i + 2;
+                                return;
+                            }
+                            eolIndex = i;
+                            nextIndex = i + 1;
+                            return;
+
+                        /* Manually decode:
+                         *  NEL is C2 85
+                         */
+                        case 0xC2:
+                            if (i + 1 < text.length && text[i + 1] == 0x85)
+                            {
+                                eolIndex = i;
+                                nextIndex = i + 2;
+                                return;
+                            }
+                            break;
+
+                        /* Manually decode:
+                         *  lineSep is E2 80 A8
+                         *  paraSep is E2 80 A9
+                         */
+                        case 0xE2:
+                            if (i + 2 < text.length &&
+                                text[i + 1] == 0x80 &&
+                                (text[i + 2] == 0xA8 || text[i + 2] == 0xA9)
+                               )
+                            {
+                                eolIndex = i;
+                                nextIndex = i + 3;
+                                return;
+                            }
+                            break;
+
+                        default:
+                            break;
                     }
                 }
             }
-
-            if (slice[$ - 1] != '\r' && slice[$ - 1] != '\n')
-            {
-                end = slice.length;
-                lines ~= cast(const(char)[])slice[start .. end];
-            }
         }
 
-        return lines;
+        return Range(text);
     }
 
     /**
diff --git a/gcc/d/dmd/foreachvar.d b/gcc/d/dmd/foreachvar.d
index dc4b20bf957..53b3c041d1e 100644
--- a/gcc/d/dmd/foreachvar.d
+++ b/gcc/d/dmd/foreachvar.d
@@ -1,7 +1,7 @@ 
 /**
  * Utility to visit every variable in an expression.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/foreachvar.d, _foreachvar.d)
diff --git a/gcc/d/dmd/func.d b/gcc/d/dmd/func.d
index feaa5bb4d91..242b4dc99f9 100644
--- a/gcc/d/dmd/func.d
+++ b/gcc/d/dmd/func.d
@@ -8,7 +8,7 @@ 
  * - `invariant`
  * - `unittest`
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/func.d, _func.d)
@@ -4253,6 +4253,9 @@  extern (C++) class StaticCtorDeclaration : FuncDeclaration
  */
 extern (C++) final class SharedStaticCtorDeclaration : StaticCtorDeclaration
 {
+    /// Exclude this constructor from cyclic dependency check
+    bool standalone;
+
     extern (D) this(const ref Loc loc, const ref Loc endloc, StorageClass stc)
     {
         super(loc, endloc, "_sharedStaticCtor", stc);
diff --git a/gcc/d/dmd/globals.d b/gcc/d/dmd/globals.d
index 9257bc464f4..b60a3f8cad1 100644
--- a/gcc/d/dmd/globals.d
+++ b/gcc/d/dmd/globals.d
@@ -1,7 +1,7 @@ 
 /**
  * Stores command line options and contains other miscellaneous declarations.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/globals.d, _globals.d)
@@ -275,7 +275,7 @@  extern (C++) struct Global
 {
     const(char)[] inifilename; /// filename of configuration file as given by `-conf=`, or default value
 
-    string copyright = "Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved";
+    string copyright = "Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved";
     string written = "written by Walter Bright";
 
     Array!(const(char)*)* path;         /// Array of char*'s which form the import lookup path
diff --git a/gcc/d/dmd/globals.h b/gcc/d/dmd/globals.h
index 4284f858466..c71d2f0499d 100644
--- a/gcc/d/dmd/globals.h
+++ b/gcc/d/dmd/globals.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/gluelayer.d b/gcc/d/dmd/gluelayer.d
index 756c0e523f9..b3980eb7930 100644
--- a/gcc/d/dmd/gluelayer.d
+++ b/gcc/d/dmd/gluelayer.d
@@ -3,7 +3,7 @@ 
  *
  * This 'glues' either the DMC or GCC back-end to the front-end.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/gluelayer.d, _gluelayer.d)
diff --git a/gcc/d/dmd/hdrgen.d b/gcc/d/dmd/hdrgen.d
index 0944ade4c28..570c662624c 100644
--- a/gcc/d/dmd/hdrgen.d
+++ b/gcc/d/dmd/hdrgen.d
@@ -3,7 +3,7 @@ 
  *
  * Also used to convert AST nodes to D code in general, e.g. for error messages or `printf` debugging.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/hdrgen.d, _hdrgen.d)
@@ -35,7 +35,6 @@  import dmd.dtemplate;
 import dmd.dversion;
 import dmd.expression;
 import dmd.func;
-import dmd.globals;
 import dmd.id;
 import dmd.identifier;
 import dmd.init;
@@ -50,7 +49,6 @@  import dmd.rootobject;
 import dmd.root.string;
 import dmd.statement;
 import dmd.staticassert;
-import dmd.target;
 import dmd.tokens;
 import dmd.visitor;
 
@@ -60,6 +58,8 @@  struct HdrGenState
     bool ddoc;          /// true if generating Ddoc file
     bool fullDump;      /// true if generating a full AST dump file
     bool importcHdr;    /// true if generating a .di file from an ImportC file
+    bool doFuncBodies;  /// include function bodies in output
+    bool vcg_ast;       /// write out codegen-ast
 
     bool fullQual;      /// fully qualify types when printing
     int tpltMember;
@@ -78,9 +78,10 @@  enum TEST_EMIT_ALL = 0;
  * Generate a header (.di) file for Module m.
  * Params:
  *      m = Module to generate header for
+ *      doFuncBodies = generate function definitions rather than just declarations
  *      buf = buffer to write the data to
  */
-extern (C++) void genhdrfile(Module m, ref OutBuffer buf)
+extern (C++) void genhdrfile(Module m, bool doFuncBodies, ref OutBuffer buf)
 {
     buf.doindent = 1;
     buf.printf("// D import file generated from '%s'", m.srcfile.toChars());
@@ -88,6 +89,7 @@  extern (C++) void genhdrfile(Module m, ref OutBuffer buf)
     HdrGenState hgs;
     hgs.hdrgen = true;
     hgs.importcHdr = (m.filetype == FileType.c);
+    hgs.doFuncBodies = doFuncBodies;
     toCBuffer(m, buf, hgs);
 }
 
@@ -108,6 +110,14 @@  public extern (C++) const(char)* toChars(const Statement s)
     return buf.extractSlice().ptr;
 }
 
+public extern (C++) const(char)* toChars(const Expression e)
+{
+    HdrGenState hgs;
+    OutBuffer buf;
+    toCBuffer(e, buf, hgs);
+    return buf.extractChars();
+}
+
 public extern (C++) const(char)* toChars(const Initializer i)
 {
     OutBuffer buf;
@@ -116,6 +126,17 @@  public extern (C++) const(char)* toChars(const Initializer i)
     return buf.extractChars();
 }
 
+public extern (C++) const(char)* toChars(const Type t)
+{
+    OutBuffer buf;
+    buf.reserve(16);
+    HdrGenState hgs;
+    hgs.fullQual = (t.ty == Tclass && !t.mod);
+
+    toCBuffer(t, buf, null, hgs);
+    return buf.extractChars();
+}
+
 public const(char)[] toString(const Initializer i)
 {
     OutBuffer buf;
@@ -128,16 +149,18 @@  public const(char)[] toString(const Initializer i)
  * Dumps the full contents of module `m` to `buf`.
  * Params:
  *   buf = buffer to write to.
+ *   vcg_ast = write out codegen ast
  *   m = module to visit all members of.
  */
-extern (C++) void moduleToBuffer(ref OutBuffer buf, Module m)
+extern (C++) void moduleToBuffer(ref OutBuffer buf, bool vcg_ast, Module m)
 {
     HdrGenState hgs;
     hgs.fullDump = true;
+    hgs.vcg_ast = vcg_ast;
     toCBuffer(m, buf, hgs);
 }
 
-void moduleToBuffer2(Module m, ref OutBuffer buf, HdrGenState* hgs)
+void moduleToBuffer2(Module m, ref OutBuffer buf, ref HdrGenState hgs)
 {
     if (m.md)
     {
@@ -171,7 +194,7 @@  void moduleToBuffer2(Module m, ref OutBuffer buf, HdrGenState* hgs)
     }
 }
 
-private void statementToBuffer(Statement s, ref OutBuffer buf, HdrGenState* hgs)
+private void statementToBuffer(Statement s, ref OutBuffer buf, ref HdrGenState hgs)
 {
     void visitDefaultCase(Statement s)
     {
@@ -240,7 +263,7 @@  private void statementToBuffer(Statement s, ref OutBuffer buf, HdrGenState* hgs)
                 auto d = ds.exp.isDeclarationExp().declaration;
                 if (auto v = d.isVarDeclaration())
                 {
-                    visitVarDecl(v, anywritten, buf, *hgs);
+                    visitVarDecl(v, anywritten, buf, hgs);
                 }
                 else
                     d.dsymbolToBuffer(buf, hgs);
@@ -803,7 +826,7 @@  private void statementToBuffer(Statement s, ref OutBuffer buf, HdrGenState* hgs)
         buf.level++;
         while (t)
         {
-            buf.writestring(t.toChars());
+            buf.writestring(t.toString());
             if (t.next &&
                 t.value != TOK.min      &&
                 t.value != TOK.comma    && t.next.value != TOK.comma    &&
@@ -844,9 +867,9 @@  private void statementToBuffer(Statement s, ref OutBuffer buf, HdrGenState* hgs)
     visit.VisitStatement(s);
 }
 
-private void dsymbolToBuffer(Dsymbol s, ref OutBuffer buf, HdrGenState* hgs)
+private void dsymbolToBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
 {
-    toCBuffer(s, buf, *hgs);
+    toCBuffer(s, buf, hgs);
 }
 
 void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
@@ -860,13 +883,13 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
     {
         buf.writestring(s.kind());
         buf.writeByte('(');
-        s.exp.expressionToBuffer(buf, &hgs);
+        s.exp.expressionToBuffer(buf, hgs);
         if (s.msgs)
         {
             foreach (m; (*s.msgs)[])
             {
                 buf.writestring(", ");
-                m.expressionToBuffer(buf, &hgs);
+                m.expressionToBuffer(buf, hgs);
             }
         }
         buf.writestring(");");
@@ -898,13 +921,13 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
     void visitEnumMember(EnumMember em)
     {
         if (em.type)
-            typeToBuffer(em.type, em.ident, buf, &hgs);
+            typeToBuffer(em.type, em.ident, buf, hgs);
         else
             buf.writestring(em.ident.toString());
         if (em.value)
         {
             buf.writestring(" = ");
-            em.value.expressionToBuffer(buf, &hgs);
+            em.value.expressionToBuffer(buf, hgs);
         }
     }
 
@@ -921,7 +944,8 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
         }
         foreach (const pid; imp.packages)
         {
-            buf.printf("%s.", pid.toChars());
+            buf.write(pid.toString());
+            buf.writeByte('.');
         }
         buf.writestring(imp.id.toString());
         if (imp.names.length)
@@ -997,7 +1021,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
     void visitDeprecatedDeclaration(DeprecatedDeclaration d)
     {
         buf.writestring("deprecated(");
-        d.msg.expressionToBuffer(buf, &hgs);
+        d.msg.expressionToBuffer(buf, hgs);
         buf.writestring(") ");
         visitAttribDeclaration(d);
     }
@@ -1050,7 +1074,9 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
             {
                 if (i)
                     buf.writeByte(' ');
-                buf.printf("align (%s)", exp.toChars());
+                buf.writestring("align (");
+                toCBuffer(exp, buf, hgs);
+                buf.writeByte(')');
             }
             if (d.decl && d.decl.length < 2)
                 buf.writeByte(' ');
@@ -1085,7 +1111,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
         if (d.args && d.args.length)
         {
             buf.writestring(", ");
-            argsToBuffer(d.args, buf, &hgs);
+            argsToBuffer(d.args, buf, hgs);
         }
 
         buf.writeByte(')');
@@ -1093,17 +1119,17 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
         // https://issues.dlang.org/show_bug.cgi?id=14690
         // Unconditionally perform a full output dump
         // for `pragma(inline)` declarations.
-        bool savedFullDump = global.params.dihdr.fullOutput;
+        const saved = hgs.doFuncBodies;
         if (d.ident == Id.Pinline)
-            global.params.dihdr.fullOutput = true;
+            hgs.doFuncBodies = true;
 
         visitAttribDeclaration(d);
-        global.params.dihdr.fullOutput = savedFullDump;
+        hgs.doFuncBodies = saved;
     }
 
     void visitConditionalDeclaration(ConditionalDeclaration d)
     {
-        d.condition.conditionToBuffer(buf, &hgs);
+        d.condition.conditionToBuffer(buf, hgs);
         if (d.decl || d.elsedecl)
         {
             buf.writenl();
@@ -1149,12 +1175,12 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
                 if (stcToBuffer(buf, p.storageClass))
                     buf.writeByte(' ');
                 if (p.type)
-                    typeToBuffer(p.type, p.ident, buf, &hgs);
+                    typeToBuffer(p.type, p.ident, buf, hgs);
                 else
                     buf.writestring(p.ident.toString());
             }
             buf.writestring("; ");
-            s.aggr.expressionToBuffer(buf, &hgs);
+            s.aggr.expressionToBuffer(buf, hgs);
             buf.writeByte(')');
             buf.writenl();
         }
@@ -1166,13 +1192,13 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
             buf.writestring(Token.toString(s.op));
             buf.writestring(" (");
             if (s.prm.type)
-                typeToBuffer(s.prm.type, s.prm.ident, buf, &hgs);
+                typeToBuffer(s.prm.type, s.prm.ident, buf, hgs);
             else
                 buf.writestring(s.prm.ident.toString());
             buf.writestring("; ");
-            s.lwr.expressionToBuffer(buf, &hgs);
+            s.lwr.expressionToBuffer(buf, hgs);
             buf.writestring(" .. ");
-            s.upr.expressionToBuffer(buf, &hgs);
+            s.upr.expressionToBuffer(buf, hgs);
             buf.writeByte(')');
             buf.writenl();
         }
@@ -1200,7 +1226,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
     void visitMixinDeclaration(MixinDeclaration d)
     {
         buf.writestring("mixin(");
-        argsToBuffer(d.exps, buf, &hgs, null);
+        argsToBuffer(d.exps, buf, hgs, null);
         buf.writestring(");");
         buf.writenl();
     }
@@ -1208,7 +1234,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
     void visitUserAttributeDeclaration(UserAttributeDeclaration d)
     {
         buf.writestring("@(");
-        argsToBuffer(d.atts, buf, &hgs);
+        argsToBuffer(d.atts, buf, hgs);
         buf.writeByte(')');
         visitAttribDeclaration(d);
     }
@@ -1218,7 +1244,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
         if (!constraint)
             return;
         buf.writestring(" if (");
-        constraint.expressionToBuffer(buf, &hgs);
+        constraint.expressionToBuffer(buf, hgs);
         buf.writeByte(')');
     }
 
@@ -1236,7 +1262,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
                 {
                     assert(es.exp && es.exp.op == EXP.assert_);
                     buf.writestring(" (");
-                    (cast(AssertExp)es.exp).e1.expressionToBuffer(buf, &hgs);
+                    (cast(AssertExp)es.exp).e1.expressionToBuffer(buf, hgs);
                     buf.writeByte(')');
                     buf.writenl();
                     requireDo = false;
@@ -1244,7 +1270,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
                 else
                 {
                     buf.writenl();
-                    frequire.statementToBuffer(buf, &hgs);
+                    frequire.statementToBuffer(buf, hgs);
                     requireDo = true;
                 }
             }
@@ -1264,7 +1290,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
                         buf.writestring(fensure.id.toString());
                     }
                     buf.writestring("; ");
-                    (cast(AssertExp)es.exp).e1.expressionToBuffer(buf, &hgs);
+                    (cast(AssertExp)es.exp).e1.expressionToBuffer(buf, hgs);
                     buf.writeByte(')');
                     buf.writenl();
                     requireDo = false;
@@ -1278,7 +1304,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
                         buf.writeByte(')');
                     }
                     buf.writenl();
-                    fensure.ensure.statementToBuffer(buf, &hgs);
+                    fensure.ensure.statementToBuffer(buf, hgs);
                     requireDo = true;
                 }
             }
@@ -1288,7 +1314,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
 
     void bodyToBuffer(FuncDeclaration f)
     {
-        if (!f.fbody || (hgs.hdrgen && global.params.dihdr.fullOutput == false && !hgs.autoMember && !hgs.tpltMember && !hgs.insideFuncBody))
+        if (!f.fbody || (hgs.hdrgen && hgs.doFuncBodies == false && !hgs.autoMember && !hgs.tpltMember && !hgs.insideFuncBody))
         {
             if (!f.fbody && (f.fensures || f.frequires))
             {
@@ -1326,7 +1352,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
         buf.writeByte('{');
         buf.writenl();
         buf.level++;
-        f.fbody.statementToBuffer(buf, &hgs);
+        f.fbody.statementToBuffer(buf, hgs);
         buf.level--;
         buf.writeByte('}');
         buf.writenl();
@@ -1344,7 +1370,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
         {
             if (i)
                 buf.writestring(", ");
-            typeToBuffer(b.type, null, buf, &hgs);
+            typeToBuffer(b.type, null, buf, hgs);
         }
     }
 
@@ -1360,7 +1386,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
             assert(fd.type);
             if (stcToBuffer(buf, fd.storage_class))
                 buf.writeByte(' ');
-            functionToBufferFull(cast(TypeFunction)fd.type, buf, d.ident, &hgs, d);
+            functionToBufferFull(cast(TypeFunction)fd.type, buf, d.ident, hgs, d);
             visitTemplateConstraint(d.constraint);
             hgs.tpltMember++;
             bodyToBuffer(fd);
@@ -1402,7 +1428,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
             if (stcToBuffer(buf, vd.storage_class))
                 buf.writeByte(' ');
             if (vd.type)
-                typeToBuffer(vd.type, vd.ident, buf, &hgs);
+                typeToBuffer(vd.type, vd.ident, buf, hgs);
             else
                 buf.writestring(vd.ident.toString());
             buf.writeByte('(');
@@ -1413,9 +1439,9 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
                 buf.writestring(" = ");
                 ExpInitializer ie = vd._init.isExpInitializer();
                 if (ie && (ie.exp.op == EXP.construct || ie.exp.op == EXP.blit))
-                    (cast(AssignExp)ie.exp).e2.expressionToBuffer(buf, &hgs);
+                    (cast(AssignExp)ie.exp).e2.expressionToBuffer(buf, hgs);
                 else
-                    vd._init.initializerToBuffer(buf, &hgs);
+                    vd._init.initializerToBuffer(buf, hgs);
             }
             buf.writeByte(';');
             buf.writenl();
@@ -1463,21 +1489,21 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
     void visitTemplateInstance(TemplateInstance ti)
     {
         buf.writestring(ti.name.toChars());
-        tiargsToBuffer(ti, buf, &hgs);
+        tiargsToBuffer(ti, buf, hgs);
 
         if (hgs.fullDump)
         {
             buf.writenl();
-            dumpTemplateInstance(ti, buf, &hgs);
+            dumpTemplateInstance(ti, buf, hgs);
         }
     }
 
     void visitTemplateMixin(TemplateMixin tm)
     {
         buf.writestring("mixin ");
-        typeToBuffer(tm.tqual, null, buf, &hgs);
-        tiargsToBuffer(tm, buf, &hgs);
-        if (tm.ident && memcmp(tm.ident.toChars(), cast(const(char)*)"__mixin", 7) != 0)
+        typeToBuffer(tm.tqual, null, buf, hgs);
+        tiargsToBuffer(tm, buf, hgs);
+        if (tm.ident && memcmp(tm.ident.toString().ptr, cast(const(char)*) "__mixin", 7) != 0)
         {
             buf.writeByte(' ');
             buf.writestring(tm.ident.toString());
@@ -1485,7 +1511,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
         buf.writeByte(';');
         buf.writenl();
         if (hgs.fullDump)
-            dumpTemplateInstance(tm, buf, &hgs);
+            dumpTemplateInstance(tm, buf, hgs);
     }
 
     void visitEnumDeclaration(EnumDeclaration d)
@@ -1501,7 +1527,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
         if (d.memtype)
         {
             buf.writestring(" : ");
-            typeToBuffer(d.memtype, null, buf, &hgs);
+            typeToBuffer(d.memtype, null, buf, hgs);
         }
         if (!d.members)
         {
@@ -1649,7 +1675,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
         {
             if (stcToBuffer(buf, d.storage_class))
                 buf.writeByte(' ');
-            typeToBuffer(d.type, d.ident, buf, &hgs);
+            typeToBuffer(d.type, d.ident, buf, hgs);
         }
         else if (d.ident)
         {
@@ -1658,7 +1684,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
             buf.writestring(" = ");
             if (stcToBuffer(buf, d.storage_class))
                 buf.writeByte(' ');
-            typeToBuffer(d.type, null, buf, &hgs);
+            typeToBuffer(d.type, null, buf, hgs);
             hgs.declstring = false;
         }
         buf.writeByte(';');
@@ -1672,7 +1698,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
         if (d.aliassym)
             toCBuffer(d.aliassym, buf, hgs);
         else // d.type
-            typeToBuffer(d.type, null, buf, &hgs);
+            typeToBuffer(d.type, null, buf, hgs);
         buf.writeByte(';');
         buf.writenl();
     }
@@ -1692,7 +1718,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
         if (stcToBuffer(buf, f.storage_class))
             buf.writeByte(' ');
         auto tf = f.type.isTypeFunction();
-        typeToBuffer(tf, f.ident, buf, &hgs);
+        typeToBuffer(tf, f.ident, buf, hgs);
 
         if (hgs.hdrgen)
         {
@@ -1706,7 +1732,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
                 bodyToBuffer(f);
                 hgs.autoMember--;
             }
-            else if (hgs.tpltMember == 0 && global.params.dihdr.fullOutput == false && !hgs.insideFuncBody)
+            else if (hgs.tpltMember == 0 && hgs.doFuncBodies == false && !hgs.insideFuncBody)
             {
                 if (!f.fbody)
                 {
@@ -1740,8 +1766,8 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
         TypeFunction tf = cast(TypeFunction)f.type;
 
         if (!f.inferRetType && tf.next)
-            typeToBuffer(tf.next, null, buf, &hgs);
-        parametersToBuffer(tf.parameterList, buf, &hgs);
+            typeToBuffer(tf.next, null, buf, hgs);
+        parametersToBuffer(tf.parameterList, buf, hgs);
 
         // https://issues.dlang.org/show_bug.cgi?id=20074
         void printAttribute(string str)
@@ -1764,7 +1790,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
         if (rs && rs.exp)
         {
             buf.writestring(" => ");
-            rs.exp.expressionToBuffer(buf, &hgs);
+            rs.exp.expressionToBuffer(buf, hgs);
         }
         else
         {
@@ -1833,7 +1859,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
         {
             assert(es.exp && es.exp.op == EXP.assert_);
             buf.writestring(" (");
-            (cast(AssertExp)es.exp).e1.expressionToBuffer(buf, &hgs);
+            (cast(AssertExp)es.exp).e1.expressionToBuffer(buf, hgs);
             buf.writestring(");");
             buf.writenl();
         }
@@ -1858,9 +1884,9 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
         if (stcToBuffer(buf, d.storage_class))
             buf.writeByte(' ');
         Identifier id = d.isAnonymous() ? null : d.ident;
-        typeToBuffer(d.type, id, buf, &hgs);
+        typeToBuffer(d.type, id, buf, hgs);
         buf.writestring(" : ");
-        d.width.expressionToBuffer(buf, &hgs);
+        d.width.expressionToBuffer(buf, hgs);
         buf.writeByte(';');
         buf.writenl();
     }
@@ -1874,7 +1900,7 @@  void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
 
     void visitModule(Module m)
     {
-        moduleToBuffer2(m, buf, &hgs);
+        moduleToBuffer2(m, buf, hgs);
     }
 
     extern (C++)
@@ -1963,9 +1989,9 @@  private void visitVarDecl(VarDeclaration v, bool anywritten, ref OutBuffer buf,
     {
         auto ie = v._init.isExpInitializer();
         if (ie && (ie.exp.op == EXP.construct || ie.exp.op == EXP.blit))
-            (cast(AssignExp)ie.exp).e2.expressionToBuffer(buf, &hgs);
+            (cast(AssignExp)ie.exp).e2.expressionToBuffer(buf, hgs);
         else
-            v._init.initializerToBuffer(buf, &hgs);
+            v._init.initializerToBuffer(buf, hgs);
     }
 
     const commentIt = hgs.importcHdr && isSpecialCName(v.ident);
@@ -1988,7 +2014,7 @@  private void visitVarDecl(VarDeclaration v, bool anywritten, ref OutBuffer buf,
         if (stcToBuffer(buf, stc))
             buf.writeByte(' ');
         if (v.type)
-            typeToBuffer(v.type, v.ident, buf, &hgs);
+            typeToBuffer(v.type, v.ident, buf, hgs);
         else if (useTypeof)
         {
             buf.writestring("typeof(");
@@ -2033,7 +2059,7 @@  private bool isSpecialCName(Identifier id)
 /*********************************************
  * Print expression to buffer.
  */
-private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState* hgs)
+private void expressionPrettyPrint(Expression e, ref OutBuffer buf, ref HdrGenState hgs)
 {
     void visit(Expression e)
     {
@@ -2042,7 +2068,7 @@  private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
 
     void visitInteger(IntegerExp e)
     {
-        const dinteger_t v = e.toInteger();
+        const ulong v = e.toInteger();
         if (e.type)
         {
             Type t = e.type;
@@ -2059,7 +2085,8 @@  private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
                         {
                             if ((cast(EnumMember)em).value.toInteger == v)
                             {
-                                buf.printf("%s.%s", sym.toChars(), em.ident.toChars());
+                                const id = em.ident.toString();
+                                buf.printf("%s.%.*s", sym.toChars(), cast(int)id.length, id.ptr);
                                 return ;
                             }
                         }
@@ -2119,15 +2146,13 @@  private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
                 break;
             case Tpointer:
                 buf.writestring("cast(");
-                buf.writestring(t.toChars());
-                buf.writeByte(')');
-                if (target.ptrsize == 8)
-                    goto case Tuns64;
-                else if (target.ptrsize == 4 ||
-                         target.ptrsize == 2)
-                    goto case Tuns32;
-                else
-                    assert(0);
+
+                HdrGenState hgs2;               // should re-examine need for new hgs
+                hgs2.fullQual = (t.ty == Tclass && !t.mod);
+                toCBuffer(t, buf, null, hgs2);
+
+                buf.writestring(")cast(size_t)");
+                goto case Tuns64;
 
             case Tvoid:
                 buf.writestring("cast(void)0");
@@ -2136,11 +2161,8 @@  private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
             default:
                 /* This can happen if errors, such as
                  * the type is painted on like in fromConstInitializer().
+                 * Just ignore
                  */
-                if (!global.errors)
-                {
-                    assert(0);
-                }
                 break;
             }
         }
@@ -2286,7 +2308,7 @@  private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
         {
             e.sds.dsymbolToBuffer(buf, hgs);
         }
-        else if (hgs !is null && hgs.ddoc)
+        else if (hgs.ddoc)
         {
             // fixes bug 6491
             if (auto m = e.sds.isModule())
@@ -2403,7 +2425,7 @@  private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
             //   which isn't correct as regular D code.
                 buf.writeByte('(');
 
-                visitVarDecl(var, false, buf, *hgs);
+                visitVarDecl(var, false, buf, hgs);
 
                 buf.writeByte(';');
                 buf.writeByte(')');
@@ -2446,7 +2468,10 @@  private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
         typeToBuffer(e.targ, e.id, buf, hgs);
         if (e.tok2 != TOK.reserved)
         {
-            buf.printf(" %s %s", Token.toChars(e.tok), Token.toChars(e.tok2));
+            buf.writeByte(' ');
+            buf.writestring(Token.toString(e.tok));
+            buf.writeByte(' ');
+            buf.writestring(Token.toString(e.tok2));
         }
         else if (e.tspec)
         {
@@ -2459,7 +2484,7 @@  private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
         if (e.parameters && e.parameters.length)
         {
             buf.writestring(", ");
-            visitTemplateParameters(e.parameters, buf, *hgs);
+            visitTemplateParameters(e.parameters, buf, hgs);
         }
         buf.writeByte(')');
     }
@@ -2472,7 +2497,7 @@  private void expressionPrettyPrint(Expression e, ref OutBuffer buf, HdrGenState*
 
     void visitLoweredAssignExp(LoweredAssignExp e)
     {
-        if (global.params.vcg_ast)
+        if (hgs.vcg_ast)
         {
             expressionToBuffer(e.lowering, buf, hgs);
             return;
@@ -2937,12 +2962,12 @@  public:
         if (tp.specType)
         {
             buf.writestring(" : ");
-            typeToBuffer(tp.specType, null, *buf, hgs);
+            typeToBuffer(tp.specType, null, *buf, *hgs);
         }
         if (tp.defaultType)
         {
             buf.writestring(" = ");
-            typeToBuffer(tp.defaultType, null, *buf, hgs);
+            typeToBuffer(tp.defaultType, null, *buf, *hgs);
         }
     }
 
@@ -2956,33 +2981,33 @@  public:
     {
         buf.writestring("alias ");
         if (tp.specType)
-            typeToBuffer(tp.specType, tp.ident, *buf, hgs);
+            typeToBuffer(tp.specType, tp.ident, *buf, *hgs);
         else
             buf.writestring(tp.ident.toString());
         if (tp.specAlias)
         {
             buf.writestring(" : ");
-            objectToBuffer(tp.specAlias, *buf, hgs);
+            objectToBuffer(tp.specAlias, *buf, *hgs);
         }
         if (tp.defaultAlias)
         {
             buf.writestring(" = ");
-            objectToBuffer(tp.defaultAlias, *buf, hgs);
+            objectToBuffer(tp.defaultAlias, *buf, *hgs);
         }
     }
 
     override void visit(TemplateValueParameter tp)
     {
-        typeToBuffer(tp.valType, tp.ident, *buf, hgs);
+        typeToBuffer(tp.valType, tp.ident, *buf, *hgs);
         if (tp.specValue)
         {
             buf.writestring(" : ");
-            tp.specValue.expressionToBuffer(*buf, hgs);
+            tp.specValue.expressionToBuffer(*buf, *hgs);
         }
         if (tp.defaultValue)
         {
             buf.writestring(" = ");
-            tp.defaultValue.expressionToBuffer(*buf, hgs);
+            tp.defaultValue.expressionToBuffer(*buf, *hgs);
         }
     }
 
@@ -2993,9 +3018,9 @@  public:
     }
 }
 
-private void conditionToBuffer(Condition c, ref OutBuffer buf, HdrGenState* hgs)
+private void conditionToBuffer(Condition c, ref OutBuffer buf, ref HdrGenState hgs)
 {
-    scope v = new ConditionPrettyPrintVisitor(&buf, hgs);
+    scope v = new ConditionPrettyPrintVisitor(&buf, &hgs);
     c.accept(v);
 }
 
@@ -3035,19 +3060,19 @@  public:
     override void visit(StaticIfCondition c)
     {
         buf.writestring("static if (");
-        c.exp.expressionToBuffer(*buf, hgs);
+        c.exp.expressionToBuffer(*buf, *hgs);
         buf.writeByte(')');
     }
 }
 
 void toCBuffer(const Statement s, ref OutBuffer buf, ref HdrGenState hgs)
 {
-    (cast()s).statementToBuffer(buf, &hgs);
+    (cast()s).statementToBuffer(buf, hgs);
 }
 
 void toCBuffer(const Type t, ref OutBuffer buf, const Identifier ident, ref HdrGenState hgs)
 {
-    typeToBuffer(cast() t, ident, buf, &hgs);
+    typeToBuffer(cast() t, ident, buf, hgs);
 }
 
 // used from TemplateInstance::toChars() and TemplateMixin::toChars()
@@ -3057,12 +3082,12 @@  void toCBufferInstance(const TemplateInstance ti, ref OutBuffer buf, bool qualif
     hgs.fullQual = qualifyTypes;
 
     buf.writestring(ti.name.toChars());
-    tiargsToBuffer(cast() ti, buf, &hgs);
+    tiargsToBuffer(cast() ti, buf, hgs);
 }
 
 void toCBuffer(const Initializer iz, ref OutBuffer buf, ref HdrGenState hgs)
 {
-    initializerToBuffer(cast() iz, buf, &hgs);
+    initializerToBuffer(cast() iz, buf, hgs);
 }
 
 bool stcToBuffer(ref OutBuffer buf, StorageClass stc) @safe
@@ -3255,7 +3280,7 @@  extern (D) string visibilityToString(Visibility.Kind kind) nothrow pure @safe
 }
 
 // Print the full function signature with correct ident, attributes and template args
-void functionToBufferFull(TypeFunction tf, ref OutBuffer buf, const Identifier ident, HdrGenState* hgs, TemplateDeclaration td)
+void functionToBufferFull(TypeFunction tf, ref OutBuffer buf, const Identifier ident, ref HdrGenState hgs, TemplateDeclaration td)
 {
     //printf("TypeFunction::toCBuffer() this = %p\n", this);
     visitFuncIdentWithPrefix(tf, ident, td, buf, hgs);
@@ -3265,12 +3290,12 @@  void functionToBufferFull(TypeFunction tf, ref OutBuffer buf, const Identifier i
 void functionToBufferWithIdent(TypeFunction tf, ref OutBuffer buf, const(char)* ident, bool isStatic)
 {
     HdrGenState hgs;
-    visitFuncIdentWithPostfix(tf, ident.toDString(), buf, &hgs, isStatic);
+    visitFuncIdentWithPostfix(tf, ident.toDString(), buf, hgs, isStatic);
 }
 
 void toCBuffer(const Expression e, ref OutBuffer buf, ref HdrGenState hgs)
 {
-    expressionPrettyPrint(cast()e, buf, &hgs);
+    expressionPrettyPrint(cast()e, buf, hgs);
 }
 
 /**************************************************
@@ -3285,7 +3310,7 @@  void argExpTypesToCBuffer(ref OutBuffer buf, Expressions* arguments)
     {
         if (i)
             buf.writestring(", ");
-        typeToBuffer(arg.type, null, buf, &hgs);
+        typeToBuffer(arg.type, null, buf, hgs);
     }
 }
 
@@ -3298,7 +3323,7 @@  void arrayObjectsToBuffer(ref OutBuffer buf, Objects* objects)
     {
         if (i)
             buf.writestring(", ");
-        objectToBuffer(o, buf, &hgs);
+        objectToBuffer(o, buf, hgs);
     }
 }
 
@@ -3312,7 +3337,7 @@  extern (C++) const(char)* parametersTypeToChars(ParameterList pl)
 {
     OutBuffer buf;
     HdrGenState hgs;
-    parametersToBuffer(pl, buf, &hgs);
+    parametersToBuffer(pl, buf, hgs);
     return buf.extractChars();
 }
 
@@ -3330,7 +3355,7 @@  const(char)* parameterToChars(Parameter parameter, TypeFunction tf, bool fullQua
     HdrGenState hgs;
     hgs.fullQual = fullQual;
 
-    parameterToBuffer(parameter, buf, &hgs);
+    parameterToBuffer(parameter, buf, hgs);
 
     if (tf.parameterList.varargs == VarArg.typesafe && parameter == tf.parameterList[tf.parameterList.parameters.length - 1])
     {
@@ -3348,7 +3373,7 @@  const(char)* parameterToChars(Parameter parameter, TypeFunction tf, bool fullQua
  *      hgs = context
  */
 
-private void parametersToBuffer(ParameterList pl, ref OutBuffer buf, HdrGenState* hgs)
+private void parametersToBuffer(ParameterList pl, ref OutBuffer buf, ref HdrGenState hgs)
 {
     buf.writeByte('(');
     foreach (i; 0 .. pl.length)
@@ -3386,7 +3411,7 @@  private void parametersToBuffer(ParameterList pl, ref OutBuffer buf, HdrGenState
  *      buf = buffer to write it to
  *      hgs = context
  */
-private void parameterToBuffer(Parameter p, ref OutBuffer buf, HdrGenState* hgs)
+private void parameterToBuffer(Parameter p, ref OutBuffer buf, ref HdrGenState hgs)
 {
     if (p.userAttribDecl)
     {
@@ -3409,7 +3434,7 @@  private void parameterToBuffer(Parameter p, ref OutBuffer buf, HdrGenState* hgs)
     if (p.storageClass & STC.in_)
     {
         buf.writestring("in ");
-        if (global.params.previewIn && p.storageClass & STC.ref_)
+        if ((p.storageClass & (STC.constscoperef | STC.ref_)) == (STC.constscoperef | STC.ref_))
             stc &= ~STC.ref_;
     }
     else if (p.storageClass & STC.lazy_)
@@ -3424,14 +3449,15 @@  private void parameterToBuffer(Parameter p, ref OutBuffer buf, HdrGenState* hgs)
         STC.return_ | STC.returninferred | STC.scope_ | STC.scopeinferred | STC.out_ | STC.ref_ | STC.returnScope)))
         buf.writeByte(' ');
 
+    const(char)[] s;
     if (p.storageClass & STC.alias_)
     {
         if (p.ident)
             buf.writestring(p.ident.toString());
     }
-    else if (p.type.ty == Tident &&
-             (cast(TypeIdentifier)p.type).ident.toString().length > 3 &&
-             strncmp((cast(TypeIdentifier)p.type).ident.toChars(), "__T", 3) == 0)
+    else if (p.type.isTypeIdentifier() &&
+             (s = p.type.isTypeIdentifier().ident.toString()).length > 3 &&
+             s[0..3] == "__T")
     {
         // print parameter name, instead of undetermined type parameter
         buf.writestring(p.ident.toString());
@@ -3458,7 +3484,7 @@  private void parameterToBuffer(Parameter p, ref OutBuffer buf, HdrGenState* hgs)
  *     basis = replace `null`s in argument list with this expression (for sparse array literals)
  *     names = if non-null, use these as the names for the arguments
  */
-private void argsToBuffer(Expressions* expressions, ref OutBuffer buf, HdrGenState* hgs, Expression basis = null, Identifiers* names = null)
+private void argsToBuffer(Expressions* expressions, ref OutBuffer buf, ref HdrGenState hgs, Expression basis = null, Identifiers* names = null)
 {
     if (!expressions || !expressions.length)
         return;
@@ -3509,26 +3535,23 @@  private void argsToBuffer(Expressions* expressions, ref OutBuffer buf, HdrGenSta
     }
 }
 
-private void sizeToBuffer(Expression e, ref OutBuffer buf, HdrGenState* hgs)
+private void sizeToBuffer(Expression e, ref OutBuffer buf, ref HdrGenState hgs)
 {
     if (e.type == Type.tsize_t)
     {
         Expression ex = (e.op == EXP.cast_ ? (cast(CastExp)e).e1 : e);
         ex = ex.optimize(WANTvalue);
-        const dinteger_t uval = ex.op == EXP.int64 ? ex.toInteger() : cast(dinteger_t)-1;
-        if (cast(sinteger_t)uval >= 0)
-        {
-            dinteger_t sizemax = void;
-            if (target.ptrsize == 8)
-                sizemax = 0xFFFFFFFFFFFFFFFFUL;
-            else if (target.ptrsize == 4)
-                sizemax = 0xFFFFFFFFU;
-            else if (target.ptrsize == 2)
-                sizemax = 0xFFFFU;
-            else
-                assert(0);
-            if (uval <= sizemax && uval <= 0x7FFFFFFFFFFFFFFFUL)
+        const ulong uval = ex.op == EXP.int64 ? ex.toInteger() : cast(ulong)-1;
+        if (cast(long)uval >= 0)
+        {
+            if (uval <= 0xFFFFU)
+            {
+                buf.print(uval);
+                return;
+            }
+            if (uval <= 0x7FFF_FFFF_FFFF_FFFFUL)
             {
+                buf.writestring("cast(size_t)");
                 buf.print(uval);
                 return;
             }
@@ -3537,7 +3560,7 @@  private void sizeToBuffer(Expression e, ref OutBuffer buf, HdrGenState* hgs)
     expToBuffer(e, PREC.assign, buf, hgs);
 }
 
-private void expressionToBuffer(Expression e, ref OutBuffer buf, HdrGenState* hgs)
+private void expressionToBuffer(Expression e, ref OutBuffer buf, ref HdrGenState hgs)
 {
     expressionPrettyPrint(e, buf, hgs);
 }
@@ -3546,7 +3569,7 @@  private void expressionToBuffer(Expression e, ref OutBuffer buf, HdrGenState* hg
  * Write expression out to buf, but wrap it
  * in ( ) if its precedence is less than pr.
  */
-private void expToBuffer(Expression e, PREC pr, ref OutBuffer buf, HdrGenState* hgs)
+private void expToBuffer(Expression e, PREC pr, ref OutBuffer buf, ref HdrGenState hgs)
 {
     debug
     {
@@ -3580,7 +3603,7 @@  private void expToBuffer(Expression e, PREC pr, ref OutBuffer buf, HdrGenState*
 /**************************************************
  * An entry point to pretty-print type.
  */
-private void typeToBuffer(Type t, const Identifier ident, ref OutBuffer buf, HdrGenState* hgs,
+private void typeToBuffer(Type t, const Identifier ident, ref OutBuffer buf, ref HdrGenState hgs,
                           ubyte modMask = 0)
 {
     if (auto tf = t.isTypeFunction())
@@ -3596,7 +3619,7 @@  private void typeToBuffer(Type t, const Identifier ident, ref OutBuffer buf, Hdr
     }
 }
 
-private void visitWithMask(Type t, ubyte modMask, ref OutBuffer buf, HdrGenState* hgs)
+private void visitWithMask(Type t, ubyte modMask, ref OutBuffer buf, ref HdrGenState hgs)
 {
     // Tuples and functions don't use the type constructor syntax
     if (modMask == t.mod || t.ty == Tfunction || t.ty == Ttuple)
@@ -3632,7 +3655,7 @@  private void visitWithMask(Type t, ubyte modMask, ref OutBuffer buf, HdrGenState
 }
 
 
-private void dumpTemplateInstance(TemplateInstance ti, ref OutBuffer buf, HdrGenState* hgs)
+private void dumpTemplateInstance(TemplateInstance ti, ref OutBuffer buf, ref HdrGenState hgs)
 {
     buf.writeByte('{');
     buf.writenl();
@@ -3655,7 +3678,7 @@  private void dumpTemplateInstance(TemplateInstance ti, ref OutBuffer buf, HdrGen
 
 }
 
-private void tiargsToBuffer(TemplateInstance ti, ref OutBuffer buf, HdrGenState* hgs)
+private void tiargsToBuffer(TemplateInstance ti, ref OutBuffer buf, ref HdrGenState hgs)
 {
     buf.writeByte('!');
     if (ti.nest)
@@ -3675,7 +3698,9 @@  private void tiargsToBuffer(TemplateInstance ti, ref OutBuffer buf, HdrGenState*
         {
             if (t.equals(Type.tstring) || t.equals(Type.twstring) || t.equals(Type.tdstring) || t.mod == 0 && (t.isTypeBasic() || t.ty == Tident && (cast(TypeIdentifier)t).idents.length == 0))
             {
-                buf.writestring(t.toChars());
+                HdrGenState hgs2;       // re-examine need for new hgs
+                hgs2.fullQual = (t.ty == Tclass && !t.mod);
+                toCBuffer(t, buf, null, hgs2);
                 return;
             }
         }
@@ -3683,7 +3708,7 @@  private void tiargsToBuffer(TemplateInstance ti, ref OutBuffer buf, HdrGenState*
         {
             if (e.op == EXP.int64 || e.op == EXP.float64 || e.op == EXP.null_ || e.op == EXP.string_ || e.op == EXP.this_)
             {
-                buf.writestring(e.toChars());
+                toCBuffer(e, buf, hgs);
                 return;
             }
         }
@@ -3704,7 +3729,7 @@  private void tiargsToBuffer(TemplateInstance ti, ref OutBuffer buf, HdrGenState*
  * This makes a 'pretty' version of the template arguments.
  * It's analogous to genIdent() which makes a mangled version.
  */
-private void objectToBuffer(RootObject oarg, ref OutBuffer buf, HdrGenState* hgs)
+private void objectToBuffer(RootObject oarg, ref OutBuffer buf, ref HdrGenState hgs)
 {
     //printf("objectToBuffer()\n");
     /* The logic of this should match what genIdent() does. The _dynamic_cast()
@@ -3725,8 +3750,10 @@  private void objectToBuffer(RootObject oarg, ref OutBuffer buf, HdrGenState* hgs
     }
     else if (Dsymbol s = isDsymbol(oarg))
     {
-        const p = s.ident ? s.ident.toChars() : s.toChars();
-        buf.writestring(p);
+        if (s.ident)
+            buf.writestring(s.ident.toString());
+        else
+            buf.writestring(s.toChars());
     }
     else if (auto v = isTuple(oarg))
     {
@@ -3757,7 +3784,7 @@  private void objectToBuffer(RootObject oarg, ref OutBuffer buf, HdrGenState* hgs
 }
 
 
-private void visitFuncIdentWithPostfix(TypeFunction t, const char[] ident, ref OutBuffer buf, HdrGenState* hgs, bool isStatic)
+private void visitFuncIdentWithPostfix(TypeFunction t, const char[] ident, ref OutBuffer buf, ref HdrGenState hgs, bool isStatic)
 {
     if (t.inuse)
     {
@@ -3802,7 +3829,7 @@  private void visitFuncIdentWithPostfix(TypeFunction t, const char[] ident, ref O
 }
 
 private void visitFuncIdentWithPrefix(TypeFunction t, const Identifier ident, TemplateDeclaration td,
-    ref OutBuffer buf, HdrGenState* hgs)
+    ref OutBuffer buf, ref HdrGenState hgs)
 {
     if (t.inuse)
     {
@@ -3858,7 +3885,7 @@  private void visitFuncIdentWithPrefix(TypeFunction t, const Identifier ident, Te
         {
             if (i)
                 buf.writestring(", ");
-            toCBuffer(p, buf, *hgs);
+            toCBuffer(p, buf, hgs);
         }
         buf.writeByte(')');
     }
@@ -3871,7 +3898,7 @@  private void visitFuncIdentWithPrefix(TypeFunction t, const Identifier ident, Te
 }
 
 
-private void initializerToBuffer(Initializer inx, ref OutBuffer buf, HdrGenState* hgs)
+private void initializerToBuffer(Initializer inx, ref OutBuffer buf, ref HdrGenState hgs)
 {
     void visitError(ErrorInitializer iz)
     {
@@ -3944,7 +3971,7 @@  private void initializerToBuffer(Initializer inx, ref OutBuffer buf, HdrGenState
                     if (d.exp)
                     {
                         buf.writeByte('[');
-                        toCBuffer(d.exp, buf, *hgs);
+                        toCBuffer(d.exp, buf, hgs);
                         buf.writeByte(']');
                     }
                     else
@@ -3965,7 +3992,7 @@  private void initializerToBuffer(Initializer inx, ref OutBuffer buf, HdrGenState
 }
 
 
-private void typeToBufferx(Type t, ref OutBuffer buf, HdrGenState* hgs)
+private void typeToBufferx(Type t, ref OutBuffer buf, ref HdrGenState hgs)
 {
     void visitType(Type t)
     {
@@ -4155,13 +4182,13 @@  private void typeToBufferx(Type t, ref OutBuffer buf, HdrGenState* hgs)
             buf.writestring("const ");
         if (hgs.importcHdr && t.id)
         {
-            buf.writestring(t.id.toChars());
+            buf.writestring(t.id.toString());
             return;
         }
-        buf.writestring(Token.toChars(t.tok));
+        buf.writestring(Token.toString(t.tok));
         buf.writeByte(' ');
         if (t.id)
-            buf.writestring(t.id.toChars());
+            buf.writestring(t.id.toString());
         if (t.tok == TOK.enum_ && t.base && t.base.ty != TY.Tint32)
         {
             buf.writestring(" : ");
diff --git a/gcc/d/dmd/hdrgen.h b/gcc/d/dmd/hdrgen.h
index e43a35510c2..e38ca569354 100644
--- a/gcc/d/dmd/hdrgen.h
+++ b/gcc/d/dmd/hdrgen.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Dave Fladebo
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
@@ -15,7 +15,7 @@ 
 
 class Module;
 
-void genhdrfile(Module *m, OutBuffer &buf);
+void genhdrfile(Module *m, bool doFuncBodies, OutBuffer &buf);
 void genCppHdrFiles(Modules &ms);
-void moduleToBuffer(OutBuffer& buf, Module *m);
+void moduleToBuffer(OutBuffer& buf, bool vcg_ast, Module *m);
 const char *parametersTypeToChars(ParameterList pl);
diff --git a/gcc/d/dmd/iasm.d b/gcc/d/dmd/iasm.d
index c58224f7deb..24a45136cd5 100644
--- a/gcc/d/dmd/iasm.d
+++ b/gcc/d/dmd/iasm.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/iasm.html, Inline Assembler)
  *
- *              Copyright (C) 2018-2023 by The D Language Foundation, All Rights Reserved
+ *              Copyright (C) 2018-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/iasm.d, _iasm.d)
diff --git a/gcc/d/dmd/iasmgcc.d b/gcc/d/dmd/iasmgcc.d
index 92837b45842..db51e734155 100644
--- a/gcc/d/dmd/iasmgcc.d
+++ b/gcc/d/dmd/iasmgcc.d
@@ -1,7 +1,7 @@ 
 /**
  * Inline assembler for the GCC D compiler.
  *
- *              Copyright (C) 2018-2023 by The D Language Foundation, All Rights Reserved
+ *              Copyright (C) 2018-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     Iain Buclaw
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/iasmgcc.d, _iasmgcc.d)
diff --git a/gcc/d/dmd/id.d b/gcc/d/dmd/id.d
index 32221d94744..a66f2af4678 100644
--- a/gcc/d/dmd/id.d
+++ b/gcc/d/dmd/id.d
@@ -1,7 +1,7 @@ 
 /**
  * Contains the `Id` struct with a list of predefined symbols the compiler knows about.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/id.d, _id.d)
@@ -521,6 +521,7 @@  immutable Msgtable[] msgtable =
     { "udaSelector", "selector" },
     { "udaOptional", "optional"},
     { "udaMustUse", "mustuse" },
+    { "udaStandalone", "standalone" },
 
     // C names, for undefined identifier error messages
     { "NULL" },
diff --git a/gcc/d/dmd/id.h b/gcc/d/dmd/id.h
index f6cf6e59c34..ddc8da23a8f 100644
--- a/gcc/d/dmd/id.h
+++ b/gcc/d/dmd/id.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 2017-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 2017-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/identifier.d b/gcc/d/dmd/identifier.d
index c2b2fbafa25..8ace310937d 100644
--- a/gcc/d/dmd/identifier.d
+++ b/gcc/d/dmd/identifier.d
@@ -1,7 +1,7 @@ 
 /**
  * Defines an identifier, which is the name of a `Dsymbol`.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/identifier.d, _identifier.d)
diff --git a/gcc/d/dmd/identifier.h b/gcc/d/dmd/identifier.h
index e7b3ba60b0f..afd3664bfa8 100644
--- a/gcc/d/dmd/identifier.h
+++ b/gcc/d/dmd/identifier.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/impcnvtab.d b/gcc/d/dmd/impcnvtab.d
index b45880a2887..b899f810aab 100644
--- a/gcc/d/dmd/impcnvtab.d
+++ b/gcc/d/dmd/impcnvtab.d
@@ -6,7 +6,7 @@ 
  * Specification: $(LINK2 https://dlang.org/spec/type.html#integer-promotions, Integer Promotions),
  *   $(LINK2 https://dlang.org/spec/type.html#usual-arithmetic-conversions, Usual Arithmetic Conversions).
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/impcnvtab.d, _impcnvtab.d)
diff --git a/gcc/d/dmd/imphint.d b/gcc/d/dmd/imphint.d
index 9e9466a38eb..ea2f13d9179 100644
--- a/gcc/d/dmd/imphint.d
+++ b/gcc/d/dmd/imphint.d
@@ -3,7 +3,7 @@ 
  *
  * For example, prompt to `import std.stdio` when using `writeln`.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/imphint.d, _imphint.d)
diff --git a/gcc/d/dmd/import.h b/gcc/d/dmd/import.h
index 2a02f13ba55..bfbb5510134 100644
--- a/gcc/d/dmd/import.h
+++ b/gcc/d/dmd/import.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/importc.d b/gcc/d/dmd/importc.d
index 2c7699b45ec..69a85ceec93 100644
--- a/gcc/d/dmd/importc.d
+++ b/gcc/d/dmd/importc.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: C11
  *
- * Copyright:   Copyright (C) 2021-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 2021-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/importc.d, _importc.d)
diff --git a/gcc/d/dmd/init.d b/gcc/d/dmd/init.d
index 5aefb0048a6..62bd41eea93 100644
--- a/gcc/d/dmd/init.d
+++ b/gcc/d/dmd/init.d
@@ -1,7 +1,7 @@ 
 /**
  * Defines initializers of variables, e.g. the array literal in `int[3] x = [0, 1, 2]`.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/init.d, _init.d)
diff --git a/gcc/d/dmd/init.h b/gcc/d/dmd/init.h
index 21bd07f4f39..b4e15e3fa98 100644
--- a/gcc/d/dmd/init.h
+++ b/gcc/d/dmd/init.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/initsem.d b/gcc/d/dmd/initsem.d
index 19d576d4660..5fe3b932599 100644
--- a/gcc/d/dmd/initsem.d
+++ b/gcc/d/dmd/initsem.d
@@ -1,7 +1,7 @@ 
 /**
  * Semantic analysis of initializers.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/initsem.d, _initsem.d)
diff --git a/gcc/d/dmd/inline.d b/gcc/d/dmd/inline.d
index afab8315f92..3e163aec4d8 100644
--- a/gcc/d/dmd/inline.d
+++ b/gcc/d/dmd/inline.d
@@ -4,7 +4,7 @@ 
  * The AST is traversed, and every function call is considered for inlining using `inlinecost.d`.
  * The function call is then inlined if this cost is below a threshold.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/inline.d, _inline.d)
diff --git a/gcc/d/dmd/intrange.d b/gcc/d/dmd/intrange.d
index 442668f6337..29c8b505cde 100644
--- a/gcc/d/dmd/intrange.d
+++ b/gcc/d/dmd/intrange.d
@@ -1,7 +1,7 @@ 
 /**
  * Implement $(LINK2 https://digitalmars.com/articles/b62.html, Value Range Propagation).
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/intrange.d, _intrange.d)
diff --git a/gcc/d/dmd/json.d b/gcc/d/dmd/json.d
index 11ab8169099..9819c3a90cc 100644
--- a/gcc/d/dmd/json.d
+++ b/gcc/d/dmd/json.d
@@ -1,7 +1,7 @@ 
 /**
  * Code for generating .json descriptions of the module when passing the `-X` flag to dmd.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/json.d, _json.d)
diff --git a/gcc/d/dmd/json.h b/gcc/d/dmd/json.h
index 09fdecdb9ee..8a949114feb 100644
--- a/gcc/d/dmd/json.h
+++ b/gcc/d/dmd/json.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/lambdacomp.d b/gcc/d/dmd/lambdacomp.d
index c90c36069fd..a1db8d52548 100644
--- a/gcc/d/dmd/lambdacomp.d
+++ b/gcc/d/dmd/lambdacomp.d
@@ -5,7 +5,7 @@ 
  * The serialization is a string which contains the type of the parameters and the string
  * represantation of the lambda expression.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/lamdbacomp.d, _lambdacomp.d)
diff --git a/gcc/d/dmd/lexer.d b/gcc/d/dmd/lexer.d
index 2c6a5950569..5eadd721f64 100644
--- a/gcc/d/dmd/lexer.d
+++ b/gcc/d/dmd/lexer.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/lex.html, Lexical)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/lexer.d, _lexer.d)
diff --git a/gcc/d/dmd/location.d b/gcc/d/dmd/location.d
index 9fe48b88844..d71ea588c91 100644
--- a/gcc/d/dmd/location.d
+++ b/gcc/d/dmd/location.d
@@ -1,7 +1,7 @@ 
 /**
  * Encapsulates file/line/column locations.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/location.d, _location.d)
diff --git a/gcc/d/dmd/mangle.h b/gcc/d/dmd/mangle.h
index aa246988f2e..68064a9210a 100644
--- a/gcc/d/dmd/mangle.h
+++ b/gcc/d/dmd/mangle.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/module.h b/gcc/d/dmd/module.h
index 80a6ea25965..d09e873c495 100644
--- a/gcc/d/dmd/module.h
+++ b/gcc/d/dmd/module.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/mtype.d b/gcc/d/dmd/mtype.d
index 626bf7431f0..4c741cdd5cc 100644
--- a/gcc/d/dmd/mtype.d
+++ b/gcc/d/dmd/mtype.d
@@ -1,7 +1,7 @@ 
 /**
  * Defines a D type.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/mtype.d, _mtype.d)
@@ -525,13 +525,7 @@  extern (C++) abstract class Type : ASTNode
      */
     final override const(char)* toChars() const
     {
-        OutBuffer buf;
-        buf.reserve(16);
-        HdrGenState hgs;
-        hgs.fullQual = (ty == Tclass && !mod);
-
-        toCBuffer(this, buf, null, hgs);
-        return buf.extractChars();
+        return dmd.hdrgen.toChars(this);
     }
 
     /// ditto
@@ -4141,7 +4135,7 @@  extern (C++) final class TypeFunction : TypeNext
         auto stc = p.storageClass;
 
         // When the preview switch is enable, `in` parameters are `scope`
-        if (stc & STC.in_ && global.params.previewIn)
+        if (stc & STC.constscoperef)
             return stc | STC.scope_;
 
         if (stc & (STC.scope_ | STC.return_ | STC.lazy_) || purity == PURE.impure)
@@ -6433,28 +6427,22 @@  extern (C++) final class Parameter : ASTNode
      * Params:
      *  returnByRef = true if the function returns by ref
      *  p = Parameter to compare with
-     *  previewIn = Whether `-preview=in` is being used, and thus if
-     *              `in` means `scope [ref]`.
-     *
      * Returns:
      *  true = `this` can be used in place of `p`
      *  false = nope
      */
-    bool isCovariant(bool returnByRef, const Parameter p, bool previewIn = global.params.previewIn)
+    bool isCovariant(bool returnByRef, const Parameter p)
         const pure nothrow @nogc @safe
     {
         ulong thisSTC = this.storageClass;
         ulong otherSTC = p.storageClass;
 
-        if (previewIn)
-        {
-            if (thisSTC & STC.in_)
-                thisSTC |= STC.scope_;
-            if (otherSTC & STC.in_)
-                otherSTC |= STC.scope_;
-        }
+        if (thisSTC & STC.constscoperef)
+            thisSTC |= STC.scope_;
+        if (otherSTC & STC.constscoperef)
+            otherSTC |= STC.scope_;
 
-        const mask = STC.ref_ | STC.out_ | STC.lazy_ | (previewIn ? STC.in_ : 0);
+        const mask = STC.ref_ | STC.out_ | STC.lazy_ | (((thisSTC | otherSTC) & STC.constscoperef) ? STC.in_ : 0);
         if ((thisSTC & mask) != (otherSTC & mask))
             return false;
         return isCovariantScope(returnByRef, thisSTC, otherSTC);
@@ -6739,7 +6727,7 @@  enum ScopeRef
  * Returns:
  *      corresponding string
  */
-const(char)* toChars(ScopeRef sr) pure nothrow @nogc @safe
+const(char)* ScopeRefToChars(ScopeRef sr) pure nothrow @nogc @safe
 {
     with (ScopeRef)
     {
diff --git a/gcc/d/dmd/mtype.h b/gcc/d/dmd/mtype.h
index ef1ce100640..97a7ae3c5af 100644
--- a/gcc/d/dmd/mtype.h
+++ b/gcc/d/dmd/mtype.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
@@ -39,6 +39,7 @@  typedef union tree_node type;
 typedef struct TYPE type;
 #endif
 
+extern const char* toChars(const Type* const t);
 Type *typeSemantic(Type *t, const Loc &loc, Scope *sc);
 Type *merge(Type *type);
 
diff --git a/gcc/d/dmd/mustuse.d b/gcc/d/dmd/mustuse.d
index 693464919e0..b5601a214dc 100644
--- a/gcc/d/dmd/mustuse.d
+++ b/gcc/d/dmd/mustuse.d
@@ -1,7 +1,7 @@ 
 /**
  * Compile-time checks associated with the @mustuse attribute.
  *
- * Copyright: Copyright (C) 2022-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 2022-2024 by The D Language Foundation, All Rights Reserved
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/mustuse.d, _mustuse.d)
  * Documentation:  https://dlang.org/phobos/dmd_mustuse.html
@@ -222,20 +222,7 @@  private bool hasMustUseAttribute(Dsymbol sym, Scope* sc)
  */
 private bool isMustUseAttribute(Expression e)
 {
-    import dmd.attrib : isCoreUda;
+    import dmd.attrib : isEnumAttribute;
     import dmd.id : Id;
-
-    // Logic based on dmd.objc.Supported.declaredAsOptionalCount
-    auto typeExp = e.isTypeExp;
-    if (!typeExp)
-        return false;
-
-    auto typeEnum = typeExp.type.isTypeEnum();
-    if (!typeEnum)
-        return false;
-
-    if (isCoreUda(typeEnum.sym, Id.udaMustUse))
-        return true;
-
-    return false;
+    return isEnumAttribute(e, Id.udaMustUse);
 }
diff --git a/gcc/d/dmd/nogc.d b/gcc/d/dmd/nogc.d
index e59b01019f4..9e45e4549ff 100644
--- a/gcc/d/dmd/nogc.d
+++ b/gcc/d/dmd/nogc.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/function.html#nogc-functions, No-GC Functions)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/nogc.d, _nogc.d)
diff --git a/gcc/d/dmd/nspace.d b/gcc/d/dmd/nspace.d
index 65f7d2964cb..52c2b79a4e5 100644
--- a/gcc/d/dmd/nspace.d
+++ b/gcc/d/dmd/nspace.d
@@ -36,7 +36,7 @@ 
  * are valid D identifier.
  *
  * See_Also:    https://github.com/dlang/dmd/pull/10031
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/nspace.d, _nspace.d)
diff --git a/gcc/d/dmd/nspace.h b/gcc/d/dmd/nspace.h
index 4a1bd9141ec..cbee2fb7914 100644
--- a/gcc/d/dmd/nspace.h
+++ b/gcc/d/dmd/nspace.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/ob.d b/gcc/d/dmd/ob.d
index dc94aecc61b..785912e1968 100644
--- a/gcc/d/dmd/ob.d
+++ b/gcc/d/dmd/ob.d
@@ -1,7 +1,7 @@ 
 /**
  * Flow analysis for Ownership/Borrowing
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/ob.d, _ob.d)
@@ -197,7 +197,7 @@  enum PtrState : ubyte
 
 /************
  */
-const(char)* toChars(PtrState state)
+const(char)* PtrStateToChars(PtrState state)
 {
     return toString(state).ptr;
 }
@@ -2490,7 +2490,7 @@  void checkObErrors(ref ObState obstate)
                     if (s1 != s2 && (s1 == PtrState.Owner || s2 == PtrState.Owner))
                     {
                         auto v = obstate.vars[i];
-                        .error(ob.exp ? ob.exp.loc : v.loc, "%s `%s` is both %s and %s", v.kind, v.toPrettyChars, s1.toChars(), s2.toChars());
+                        .error(ob.exp ? ob.exp.loc : v.loc, "%s `%s` is both %s and %s", v.kind, v.toPrettyChars, PtrStateToChars(s1), PtrStateToChars(s2));
                     }
                     pvs1.combine(*pvs2, i, ob.gen);
                 }
diff --git a/gcc/d/dmd/objc.d b/gcc/d/dmd/objc.d
index 359474c588a..2f36d5d13da 100644
--- a/gcc/d/dmd/objc.d
+++ b/gcc/d/dmd/objc.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/objc_interface.html, Interfacing to Objective-C)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/objc.d, _objc.d)
diff --git a/gcc/d/dmd/objc.h b/gcc/d/dmd/objc.h
index 40f634e9122..0390115aeb1 100644
--- a/gcc/d/dmd/objc.h
+++ b/gcc/d/dmd/objc.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 2015-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 2015-2024 by The D Language Foundation, All Rights Reserved
  * written by Michel Fortin
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/opover.d b/gcc/d/dmd/opover.d
index b7bc9257b3e..d596b8487f2 100644
--- a/gcc/d/dmd/opover.d
+++ b/gcc/d/dmd/opover.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/operatoroverloading.html, Operator Overloading)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/opover.d, _opover.d)
diff --git a/gcc/d/dmd/optimize.d b/gcc/d/dmd/optimize.d
index a9791684df4..f86abde5c3e 100644
--- a/gcc/d/dmd/optimize.d
+++ b/gcc/d/dmd/optimize.d
@@ -1,7 +1,7 @@ 
 /**
  * Perform constant folding.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/optimize.d, _optimize.d)
diff --git a/gcc/d/dmd/parse.d b/gcc/d/dmd/parse.d
index b6f30b93f47..a012e0c7c5b 100644
--- a/gcc/d/dmd/parse.d
+++ b/gcc/d/dmd/parse.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/grammar.html, D Grammar)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/parse.d, _parse.d)
@@ -2899,6 +2899,8 @@  class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
                     if (transitionIn)
                         eSink.message(scanloc, "Usage of 'in' on parameter");
                     stc = STC.in_;
+                    if (compileEnv.previewIn)
+                        stc |= STC.constscoperef;
                     goto L2;
 
                 case TOK.out_:
@@ -2936,9 +2938,9 @@  class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
 
                 default:
                     {
-                        stc = storageClass & (STC.IOR | STC.lazy_);
-                        // if stc is not a power of 2
-                        if (stc & (stc - 1) && !(stc == (STC.in_ | STC.ref_)))
+                        const stcx = storageClass & (STC.in_ | STC.ref_ | STC.out_ | STC.lazy_);
+                        // if stcx is not a power of 2
+                        if (stcx & (stcx - 1) && !(stcx == (STC.in_ | STC.ref_)))
                             error("incompatible parameter storage classes");
                         //if ((storageClass & STC.scope_) && (storageClass & (STC.ref_ | STC.out_)))
                             //error("scope cannot be ref or out");
diff --git a/gcc/d/dmd/postordervisitor.d b/gcc/d/dmd/postordervisitor.d
index 70bd1300feb..fe189d47e94 100644
--- a/gcc/d/dmd/postordervisitor.d
+++ b/gcc/d/dmd/postordervisitor.d
@@ -1,7 +1,7 @@ 
 /**
  * A depth-first visitor for expressions.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/apply.d, _apply.d)
diff --git a/gcc/d/dmd/printast.d b/gcc/d/dmd/printast.d
index e1deb2c8786..02dc65390b0 100644
--- a/gcc/d/dmd/printast.d
+++ b/gcc/d/dmd/printast.d
@@ -1,7 +1,7 @@ 
 /**
  * Provides an AST printer for debugging.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/printast.d, _printast.d)
diff --git a/gcc/d/dmd/root/aav.d b/gcc/d/dmd/root/aav.d
index 1d450505a4d..8929679e37e 100644
--- a/gcc/d/dmd/root/aav.d
+++ b/gcc/d/dmd/root/aav.d
@@ -1,7 +1,7 @@ 
 /**
  * Associative array implementation.
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:   Walter Bright, https://www.digitalmars.com
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/aav.d, root/_aav.d)
diff --git a/gcc/d/dmd/root/array.d b/gcc/d/dmd/root/array.d
index f36ddb4f29e..81355774de3 100644
--- a/gcc/d/dmd/root/array.d
+++ b/gcc/d/dmd/root/array.d
@@ -2,7 +2,7 @@ 
 /**
  * Dynamic array implementation.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/array.d, root/_array.d)
diff --git a/gcc/d/dmd/root/array.h b/gcc/d/dmd/root/array.h
index ebe2c47d0a0..1033b22237a 100644
--- a/gcc/d/dmd/root/array.h
+++ b/gcc/d/dmd/root/array.h
@@ -1,4 +1,4 @@ 
-/* Copyright (C) 2011-2023 by The D Language Foundation, All Rights Reserved
+/* Copyright (C) 2011-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/root/bitarray.d b/gcc/d/dmd/root/bitarray.d
index 66adab65877..c32d59eec36 100644
--- a/gcc/d/dmd/root/bitarray.d
+++ b/gcc/d/dmd/root/bitarray.d
@@ -1,7 +1,7 @@ 
 /**
  * Implementation of a bit array.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/bitarray.d, root/_bitarray.d)
diff --git a/gcc/d/dmd/root/bitarray.h b/gcc/d/dmd/root/bitarray.h
index 617cc9e2cfa..2cd7152f725 100644
--- a/gcc/d/dmd/root/bitarray.h
+++ b/gcc/d/dmd/root/bitarray.h
@@ -1,4 +1,4 @@ 
-/* Copyright (C) 2011-2023 by The D Language Foundation, All Rights Reserved
+/* Copyright (C) 2011-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/root/complex.d b/gcc/d/dmd/root/complex.d
index 57d1e340eff..de4c8d34678 100644
--- a/gcc/d/dmd/root/complex.d
+++ b/gcc/d/dmd/root/complex.d
@@ -1,7 +1,7 @@ 
 /**
  * Implements a complex number type.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/complex.d, _complex.d)
diff --git a/gcc/d/dmd/root/complex_t.h b/gcc/d/dmd/root/complex_t.h
index de2040b88f7..8134f9e2591 100644
--- a/gcc/d/dmd/root/complex_t.h
+++ b/gcc/d/dmd/root/complex_t.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/root/ctfloat.d b/gcc/d/dmd/root/ctfloat.d
index aae56fac02b..70446066593 100644
--- a/gcc/d/dmd/root/ctfloat.d
+++ b/gcc/d/dmd/root/ctfloat.d
@@ -1,7 +1,7 @@ 
 /**
  * Collects functions for compile-time floating-point calculations.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/ctfloat.d, root/_ctfloat.d)
diff --git a/gcc/d/dmd/root/ctfloat.h b/gcc/d/dmd/root/ctfloat.h
index d2f795bf9e9..ba8b4478246 100644
--- a/gcc/d/dmd/root/ctfloat.h
+++ b/gcc/d/dmd/root/ctfloat.h
@@ -1,5 +1,5 @@ 
 
-/* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+/* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/root/dcompat.h b/gcc/d/dmd/root/dcompat.h
index 1a496880100..db2b2c6abcd 100644
--- a/gcc/d/dmd/root/dcompat.h
+++ b/gcc/d/dmd/root/dcompat.h
@@ -1,5 +1,5 @@ 
 
-/* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+/* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/root/file.d b/gcc/d/dmd/root/file.d
index fdf13d4e8b0..a4362e17178 100644
--- a/gcc/d/dmd/root/file.d
+++ b/gcc/d/dmd/root/file.d
@@ -1,7 +1,7 @@ 
 /**
  * Read a file from disk and store it in memory.
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:   Walter Bright, https://www.digitalmars.com
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/file.d, root/_file.d)
diff --git a/gcc/d/dmd/root/filename.d b/gcc/d/dmd/root/filename.d
index 8f31f212048..5b0bba42fc2 100644
--- a/gcc/d/dmd/root/filename.d
+++ b/gcc/d/dmd/root/filename.d
@@ -1,7 +1,7 @@ 
 /**
  * Encapsulate path and file names.
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:   Walter Bright, https://www.digitalmars.com
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/filename.d, root/_filename.d)
diff --git a/gcc/d/dmd/root/filename.h b/gcc/d/dmd/root/filename.h
index 62142331013..d8834a19282 100644
--- a/gcc/d/dmd/root/filename.h
+++ b/gcc/d/dmd/root/filename.h
@@ -1,5 +1,5 @@ 
 
-/* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+/* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/root/hash.d b/gcc/d/dmd/root/hash.d
index 2acee35c4f3..441620e60b4 100644
--- a/gcc/d/dmd/root/hash.d
+++ b/gcc/d/dmd/root/hash.d
@@ -1,7 +1,7 @@ 
 /**
  * Hash functions for arbitrary binary data.
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:   Martin Nowak, Walter Bright, https://www.digitalmars.com
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/hash.d, root/_hash.d)
diff --git a/gcc/d/dmd/root/object.h b/gcc/d/dmd/root/object.h
index 8e505f036c7..f56cb176017 100644
--- a/gcc/d/dmd/root/object.h
+++ b/gcc/d/dmd/root/object.h
@@ -1,5 +1,5 @@ 
 
-/* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+/* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/root/optional.d b/gcc/d/dmd/root/optional.d
index bc1016b102a..e7d0e1ef785 100644
--- a/gcc/d/dmd/root/optional.d
+++ b/gcc/d/dmd/root/optional.d
@@ -1,7 +1,7 @@ 
 /**
  * Implementation of an 'Optional' type
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/optional.d, root/_optional.d)
diff --git a/gcc/d/dmd/root/optional.h b/gcc/d/dmd/root/optional.h
index 353332c2199..a92deddc638 100644
--- a/gcc/d/dmd/root/optional.h
+++ b/gcc/d/dmd/root/optional.h
@@ -3,7 +3,7 @@ 
 /**
  * Optional implementation.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/optional.h, root/_optional.h)
diff --git a/gcc/d/dmd/root/port.d b/gcc/d/dmd/root/port.d
index 290280f619c..ee846bdb291 100644
--- a/gcc/d/dmd/root/port.d
+++ b/gcc/d/dmd/root/port.d
@@ -1,7 +1,7 @@ 
 /**
  * Portable routines for functions that have different implementations on different platforms.
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:   Walter Bright, https://www.digitalmars.com
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/port.d, root/_port.d)
diff --git a/gcc/d/dmd/root/port.h b/gcc/d/dmd/root/port.h
index 6fa3c000e5a..6c7dddd43ae 100644
--- a/gcc/d/dmd/root/port.h
+++ b/gcc/d/dmd/root/port.h
@@ -1,5 +1,5 @@ 
 
-/* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+/* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/root/region.d b/gcc/d/dmd/root/region.d
index 9fc57f1e3a8..a9fab162537 100644
--- a/gcc/d/dmd/root/region.d
+++ b/gcc/d/dmd/root/region.d
@@ -1,7 +1,7 @@ 
 /**
  * Region storage allocator implementation.
  *
- * Copyright:   Copyright (C) 2019-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 2019-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/region.d, root/_region.d)
diff --git a/gcc/d/dmd/root/rmem.d b/gcc/d/dmd/root/rmem.d
index cff5c4cf7ec..19652072376 100644
--- a/gcc/d/dmd/root/rmem.d
+++ b/gcc/d/dmd/root/rmem.d
@@ -1,7 +1,7 @@ 
 /**
  * Allocate memory using `malloc` or the GC depending on the configuration.
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:   Walter Bright, https://www.digitalmars.com
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/rmem.d, root/_rmem.d)
diff --git a/gcc/d/dmd/root/rmem.h b/gcc/d/dmd/root/rmem.h
index 36aa2646fdc..09c0fc07ccc 100644
--- a/gcc/d/dmd/root/rmem.h
+++ b/gcc/d/dmd/root/rmem.h
@@ -1,5 +1,5 @@ 
 
-/* Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+/* Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/root/speller.d b/gcc/d/dmd/root/speller.d
index 7ad08b7216e..ae09cba37fc 100644
--- a/gcc/d/dmd/root/speller.d
+++ b/gcc/d/dmd/root/speller.d
@@ -3,7 +3,7 @@ 
  *
  * Does not have any dependencies on the rest of DMD.
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:   Walter Bright, https://www.digitalmars.com
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/speller.d, root/_speller.d)
diff --git a/gcc/d/dmd/root/string.d b/gcc/d/dmd/root/string.d
index 5ee81a9b63d..e82b0d2fe6d 100644
--- a/gcc/d/dmd/root/string.d
+++ b/gcc/d/dmd/root/string.d
@@ -1,7 +1,7 @@ 
 /**
  * Contains various string related functions.
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:   Walter Bright, https://www.digitalmars.com
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/string.d, root/_string.d)
diff --git a/gcc/d/dmd/root/stringtable.d b/gcc/d/dmd/root/stringtable.d
index de293eb9b55..1fba919dec5 100644
--- a/gcc/d/dmd/root/stringtable.d
+++ b/gcc/d/dmd/root/stringtable.d
@@ -1,7 +1,7 @@ 
 /**
  * A specialized associative array with string keys stored in a variable length structure.
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:   Walter Bright, https://www.digitalmars.com
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/stringtable.d, root/_stringtable.d)
diff --git a/gcc/d/dmd/root/utf.d b/gcc/d/dmd/root/utf.d
index d7ba17f8a0b..7d732f2fbe8 100644
--- a/gcc/d/dmd/root/utf.d
+++ b/gcc/d/dmd/root/utf.d
@@ -1,7 +1,7 @@ 
 /**
  * Functions related to UTF encoding.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/utf.d, _utf.d)
diff --git a/gcc/d/dmd/rootobject.d b/gcc/d/dmd/rootobject.d
index 7867ad5de31..7c926fea055 100644
--- a/gcc/d/dmd/rootobject.d
+++ b/gcc/d/dmd/rootobject.d
@@ -1,7 +1,7 @@ 
 /**
  * Provide the root object that AST classes in dmd inherit from.
  *
- * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:   Walter Bright, https://www.digitalmars.com
  * License:   $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:    $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/rootobject.d, _rootobject.d)
diff --git a/gcc/d/dmd/safe.d b/gcc/d/dmd/safe.d
index bd531c0081e..af81bff0dd1 100644
--- a/gcc/d/dmd/safe.d
+++ b/gcc/d/dmd/safe.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/function.html#function-safety, Function Safety)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/safe.d, _safe.d)
diff --git a/gcc/d/dmd/sapply.d b/gcc/d/dmd/sapply.d
index 13fe6916531..340fbad78d4 100644
--- a/gcc/d/dmd/sapply.d
+++ b/gcc/d/dmd/sapply.d
@@ -1,7 +1,7 @@ 
 /**
  * Provides a depth-first statement visitor.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/sparse.d, _sparse.d)
diff --git a/gcc/d/dmd/scope.h b/gcc/d/dmd/scope.h
index cceb5a7e3a8..1535fd07755 100644
--- a/gcc/d/dmd/scope.h
+++ b/gcc/d/dmd/scope.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/semantic2.d b/gcc/d/dmd/semantic2.d
index 036560b5407..937e746270a 100644
--- a/gcc/d/dmd/semantic2.d
+++ b/gcc/d/dmd/semantic2.d
@@ -1,7 +1,7 @@ 
 /**
  * Performs the semantic2 stage, which deals with initializer expressions.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/semantic2.d, _semantic2.d)
@@ -93,6 +93,13 @@  private extern(C++) final class Semantic2Visitor : Visitor
     override void visit(StaticAssert sa)
     {
         //printf("StaticAssert::semantic2() %s\n", sa.toChars());
+        if (const e = sa.exp.isStringExp())
+        {
+            // deprecated in 2.107
+            deprecation(e.loc, "static assert condition cannot be a string literal");
+            deprecationSupplemental(e.loc, "If intentional, use `%s !is null` instead to preserve behaviour",
+                e.toChars());
+        }
         auto sds = new ScopeDsymbol();
         sc = sc.push(sds);
         sc.tinst = null;
diff --git a/gcc/d/dmd/semantic3.d b/gcc/d/dmd/semantic3.d
index 7498eaf4458..520e05f4190 100644
--- a/gcc/d/dmd/semantic3.d
+++ b/gcc/d/dmd/semantic3.d
@@ -1,7 +1,7 @@ 
 /**
  * Performs the semantic3 stage, which deals with function bodies.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/semantic3.d, _semantic3.d)
diff --git a/gcc/d/dmd/sideeffect.d b/gcc/d/dmd/sideeffect.d
index 80c9a46958f..59398a70cb8 100644
--- a/gcc/d/dmd/sideeffect.d
+++ b/gcc/d/dmd/sideeffect.d
@@ -1,7 +1,7 @@ 
 /**
  * Find side-effects of expressions.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/sideeffect.d, _sideeffect.d)
diff --git a/gcc/d/dmd/statement.d b/gcc/d/dmd/statement.d
index 430454480e1..a79b78acf24 100644
--- a/gcc/d/dmd/statement.d
+++ b/gcc/d/dmd/statement.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/statement.html, Statements)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/statement.d, _statement.d)
diff --git a/gcc/d/dmd/statement.h b/gcc/d/dmd/statement.h
index 1e493f0d188..ee03d49eb4a 100644
--- a/gcc/d/dmd/statement.h
+++ b/gcc/d/dmd/statement.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/statement_rewrite_walker.d b/gcc/d/dmd/statement_rewrite_walker.d
index dcdd9630002..221c5021c52 100644
--- a/gcc/d/dmd/statement_rewrite_walker.d
+++ b/gcc/d/dmd/statement_rewrite_walker.d
@@ -1,7 +1,7 @@ 
 /**
  * Provides a visitor for statements that allows rewriting the currently visited node.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/statement_rewrite_walker.d, _statement_rewrite_walker.d)
diff --git a/gcc/d/dmd/statementsem.d b/gcc/d/dmd/statementsem.d
index fcc606b6dd5..229cf17bb6a 100644
--- a/gcc/d/dmd/statementsem.d
+++ b/gcc/d/dmd/statementsem.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/statement.html, Statements)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/statementsem.d, _statementsem.d)
@@ -568,8 +568,8 @@  Statement statementSemanticVisit(Statement s, Scope* sc)
             ds._body = ds._body.semanticScope(sc, ds, ds, null);
         sc.inLoop = inLoopSave;
 
-        if (ds.condition.op == EXP.dotIdentifier)
-            (cast(DotIdExp)ds.condition).noderef = true;
+        if (auto dotid = ds.condition.isDotIdExp())
+            dotid.noderef = true;
 
         // check in syntax level
         ds.condition = checkAssignmentAsCondition(ds.condition, sc);
@@ -641,8 +641,8 @@  Statement statementSemanticVisit(Statement s, Scope* sc)
 
         if (fs.condition)
         {
-            if (fs.condition.op == EXP.dotIdentifier)
-                (cast(DotIdExp)fs.condition).noderef = true;
+            if (auto dotid = fs.condition.isDotIdExp())
+                dotid.noderef = true;
 
             // check in syntax level
             fs.condition = checkAssignmentAsCondition(fs.condition, sc);
@@ -729,8 +729,8 @@  Statement statementSemanticVisit(Statement s, Scope* sc)
         if (fs.aggr.op == EXP.error)
             return setError();
         Expression oaggr = fs.aggr;     // remember original for error messages
-        if (fs.aggr.type && fs.aggr.type.toBasetype().ty == Tstruct &&
-            (cast(TypeStruct)(fs.aggr.type.toBasetype())).sym.dtor &&
+        if (fs.aggr.type && fs.aggr.type.toBasetype().isTypeStruct() &&
+            fs.aggr.type.toBasetype().isTypeStruct().sym.dtor &&
             !fs.aggr.isTypeExp() && !fs.aggr.isLvalue())
         {
             // https://issues.dlang.org/show_bug.cgi?id=14653
@@ -804,9 +804,9 @@  Statement statementSemanticVisit(Statement s, Scope* sc)
                         Parameter fparam = fparameters[0];
                         if ((fparam.type.ty == Tpointer ||
                              fparam.type.ty == Tdelegate) &&
-                            fparam.type.nextOf().ty == Tfunction)
+                            fparam.type.nextOf().isTypeFunction())
                         {
-                            TypeFunction tf = cast(TypeFunction)fparam.type.nextOf();
+                            auto tf = fparam.type.nextOf().isTypeFunction();
                             foreachParamCount = tf.parameterList.length;
                             foundMismatch = true;
                         }
@@ -1644,8 +1644,8 @@  Statement statementSemanticVisit(Statement s, Scope* sc)
         }
         else
         {
-            if (ifs.condition.op == EXP.dotIdentifier)
-                (cast(DotIdExp)ifs.condition).noderef = true;
+            if (auto dotid = ifs.condition.isDotIdExp())
+                dotid.noderef = true;
 
             ifs.condition = ifs.condition.expressionSemantic(scd);
             ifs.condition = resolveProperties(scd, ifs.condition);
@@ -1910,8 +1910,8 @@  Statement statementSemanticVisit(Statement s, Scope* sc)
         while (!ss.condition.isErrorExp())
         {
             // preserve enum type for final switches
-            if (ss.condition.type.ty == Tenum)
-                te = cast(TypeEnum)ss.condition.type;
+            if (auto tenum = ss.condition.type.isTypeEnum())
+                te = tenum;
             if (ss.condition.type.isString())
             {
                 // If it's not an array, cast it to one
@@ -2222,14 +2222,13 @@  Statement statementSemanticVisit(Statement s, Scope* sc)
             Expression e = cs.exp;
             // Remove all the casts the user and/or implicitCastTo may introduce
             // otherwise we'd sometimes fail the check below.
-            while (e.op == EXP.cast_)
-                e = (cast(CastExp)e).e1;
+            while (e.isCastExp())
+                e = e.isCastExp().e1;
 
             /* This is where variables are allowed as case expressions.
             */
-            if (e.op == EXP.variable)
+            if (auto ve = e.isVarExp())
             {
-                VarExp ve = cast(VarExp)e;
                 VarDeclaration v = ve.var.isVarDeclaration();
                 Type t = cs.exp.type.toBasetype();
                 if (v && (t.isintegral() || t.ty == Tclass))
@@ -3227,9 +3226,9 @@  Statement statementSemanticVisit(Statement s, Scope* sc)
             sym.parent = sc.scopesym;
             sym.endlinnum = ws.endloc.linnum;
         }
-        else if (ws.exp.op == EXP.type)
+        else if (auto et = ws.exp.isTypeExp())
         {
-            Dsymbol s = (cast(TypeExp)ws.exp).type.toDsymbol(sc);
+            Dsymbol s = et.type.toDsymbol(sc);
             if (!s || !s.isScopeDsymbol())
             {
                 error(ws.loc, "`with` type `%s` has no members", ws.exp.toChars());
@@ -3767,16 +3766,15 @@  public bool throwSemantic(const ref Loc loc, ref Expression exp, Scope* sc)
     if (FuncDeclaration fd = sc.parent.isFuncDeclaration())
         fd.hasReturnExp |= 2;
 
-    if (exp.op == EXP.new_)
+    if (auto ne = exp.isNewExp())
     {
-        NewExp ne = cast(NewExp) exp;
         ne.thrownew = true;
     }
 
     exp = exp.expressionSemantic(sc);
     exp = resolveProperties(sc, exp);
     exp = checkGC(sc, exp);
-    if (exp.op == EXP.error)
+    if (exp.isErrorExp())
         return false;
     if (!exp.type.isNaked())
     {
@@ -3805,12 +3803,12 @@  private extern(D) Expression applyOpApply(ForeachStatement fs, Expression flde,
         {
             message(loc, "To enforce `@safe`, the compiler allocates a closure unless `opApply()` uses `scope`");
         }
-        (cast(FuncExp)flde).fd.tookAddressOf = 1;
+        flde.isFuncExp().fd.tookAddressOf = 1;
     }
     else
     {
         if (sc2.useDIP1000 == FeatureState.enabled)
-            ++(cast(FuncExp)flde).fd.tookAddressOf;  // allocate a closure unless the opApply() uses 'scope'
+            ++flde.isFuncExp().fd.tookAddressOf;  // allocate a closure unless the opApply() uses 'scope'
     }
     assert(tab.ty == Tstruct || tab.ty == Tclass);
     assert(sapply);
@@ -3821,7 +3819,7 @@  private extern(D) Expression applyOpApply(ForeachStatement fs, Expression flde,
     ec = new DotIdExp(fs.loc, fs.aggr, sapply.ident);
     ec = new CallExp(fs.loc, ec, flde);
     ec = ec.expressionSemantic(sc2);
-    if (ec.op == EXP.error)
+    if (ec.isErrorExp())
         return null;
     if (ec.type != Type.tint32)
     {
@@ -3838,11 +3836,12 @@  private extern(D) Expression applyDelegate(ForeachStatement fs, Expression flde,
     /* Call:
      *      aggr(flde)
      */
-    if (fs.aggr.op == EXP.delegate_ && (cast(DelegateExp)fs.aggr).func.isNested() &&
-        !(cast(DelegateExp)fs.aggr).func.needThis())
+    if (auto de = fs.aggr.isDelegateExp())
+    if (de.func.isNested() &&
+        !de.func.needThis())
     {
         // https://issues.dlang.org/show_bug.cgi?id=3560
-        fs.aggr = (cast(DelegateExp)fs.aggr).e1;
+        fs.aggr = de.e1;
     }
     ec = new CallExp(fs.loc, fs.aggr, flde);
     ec = ec.expressionSemantic(sc2);
@@ -4099,7 +4098,7 @@  private FuncExp foreachBodyToFunction(Scope* sc, ForeachStatement fs, TypeFuncti
     fld.tookAddressOf = 0;
     if (flde.op == EXP.error)
         return null;
-    return cast(FuncExp)flde;
+    return flde.isFuncExp();
 }
 
 
@@ -4273,9 +4272,9 @@  Statement scopeCode(Statement statement, Scope* sc, out Statement sentry, out St
 {
     if (auto es = statement.isExpStatement())
     {
-        if (es.exp && es.exp.op == EXP.declaration)
+        if (es.exp && es.exp.isDeclarationExp())
         {
-            auto de = cast(DeclarationExp)es.exp;
+            auto de = es.exp.isDeclarationExp();
             auto v = de.declaration.isVarDeclaration();
             if (v && !v.isDataseg())
             {
@@ -4401,7 +4400,7 @@  public auto makeTupleForeach(Scope* sc, bool isStatic, bool isDecl, ForeachState
     }
 
     Type tab = fs.aggr.type.toBasetype();
-    TypeTuple tuple = cast(TypeTuple)tab;
+    TypeTuple tuple = tab.isTypeTuple();
 
     Statements* statements;
     Dsymbols* declarations;
@@ -4413,12 +4412,12 @@  public auto makeTupleForeach(Scope* sc, bool isStatic, bool isDecl, ForeachState
     //printf("aggr: op = %d, %s\n", fs.aggr.op, fs.aggr.toChars());
     size_t n;
     TupleExp te = null;
-    if (fs.aggr.op == EXP.tuple) // expression tuple
+    if (auto ate =  fs.aggr.isTupleExp()) // expression tuple
     {
-        te = cast(TupleExp)fs.aggr;
+        te = ate;
         n = te.exps.length;
     }
-    else if (fs.aggr.op == EXP.type) // type tuple
+    else if (fs.aggr.isTypeExp()) // type tuple
     {
         n = Parameter.dim(tuple.arguments);
     }
diff --git a/gcc/d/dmd/staticassert.d b/gcc/d/dmd/staticassert.d
index 760c66a415a..08780ca0781 100644
--- a/gcc/d/dmd/staticassert.d
+++ b/gcc/d/dmd/staticassert.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/version.html#static-assert, Static Assert)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/staticassert.d, _staticassert.d)
@@ -49,10 +49,10 @@  extern (C++) final class StaticAssert : Dsymbol
         return new StaticAssert(loc, exp.syntaxCopy(), msgs ? Expression.arraySyntaxCopy(msgs) : null);
     }
 
-    override bool oneMember(Dsymbol* ps, Identifier ident)
+    override bool oneMember(out Dsymbol ps, Identifier ident)
     {
         //printf("StaticAssert::oneMember())\n");
-        *ps = null;
+        ps = null;
         return true;
     }
 
diff --git a/gcc/d/dmd/staticassert.h b/gcc/d/dmd/staticassert.h
index c0d5363a414..ed76de07012 100644
--- a/gcc/d/dmd/staticassert.h
+++ b/gcc/d/dmd/staticassert.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
@@ -21,7 +21,7 @@  public:
     Expressions *msg;
 
     StaticAssert *syntaxCopy(Dsymbol *s) override;
-    bool oneMember(Dsymbol **ps, Identifier *ident) override;
+    bool oneMember(Dsymbol *&ps, Identifier *ident) override;
     const char *kind() const override;
     StaticAssert *isStaticAssert() override { return this; }
     void accept(Visitor *v) override { v->visit(this); }
diff --git a/gcc/d/dmd/staticcond.d b/gcc/d/dmd/staticcond.d
index 1d18de31829..72afe029641 100644
--- a/gcc/d/dmd/staticcond.d
+++ b/gcc/d/dmd/staticcond.d
@@ -1,7 +1,7 @@ 
 /**
  * Lazily evaluate static conditions for `static if`, `static assert` and template constraints.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/staticcond.d, _staticcond.d)
diff --git a/gcc/d/dmd/stmtstate.d b/gcc/d/dmd/stmtstate.d
index 7b2ea972f0e..e1ed16594a8 100644
--- a/gcc/d/dmd/stmtstate.d
+++ b/gcc/d/dmd/stmtstate.d
@@ -1,7 +1,7 @@ 
 /**
  * Used to help transform statement AST into flow graph.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/stmtstate.d, _stmtstate.d)
diff --git a/gcc/d/dmd/target.d b/gcc/d/dmd/target.d
index aba3319247b..e63bf17a5f7 100644
--- a/gcc/d/dmd/target.d
+++ b/gcc/d/dmd/target.d
@@ -15,7 +15,7 @@ 
  * - $(LINK2 https://github.com/ldc-developers/ldc, LDC repository)
  * - $(LINK2 https://github.com/D-Programming-GDC/gcc, GDC repository)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/target.d, _target.d)
diff --git a/gcc/d/dmd/target.h b/gcc/d/dmd/target.h
index ca0e09c88e0..120950570d4 100644
--- a/gcc/d/dmd/target.h
+++ b/gcc/d/dmd/target.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 2013-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 2013-2024 by The D Language Foundation, All Rights Reserved
  * written by Iain Buclaw
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/template.h b/gcc/d/dmd/template.h
index 4be136102c2..09c4912a521 100644
--- a/gcc/d/dmd/template.h
+++ b/gcc/d/dmd/template.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
@@ -290,7 +290,7 @@  public:
     TemplateInstance *syntaxCopy(Dsymbol *) override;
     Dsymbol *toAlias() override final;   // resolve real symbol
     const char *kind() const override;
-    bool oneMember(Dsymbol **ps, Identifier *ident) override;
+    bool oneMember(Dsymbol *&ps, Identifier *ident) override;
     const char *toChars() const override;
     const char* toPrettyCharsHelper() override final;
     Identifier *getIdent() override final;
@@ -309,7 +309,7 @@  public:
 
     TemplateMixin *syntaxCopy(Dsymbol *s) override;
     const char *kind() const override;
-    bool oneMember(Dsymbol **ps, Identifier *ident) override;
+    bool oneMember(Dsymbol *&ps, Identifier *ident) override;
     bool hasPointers() override;
     const char *toChars() const override;
 
diff --git a/gcc/d/dmd/templateparamsem.d b/gcc/d/dmd/templateparamsem.d
index 7762363c8d6..89749d6b7f3 100644
--- a/gcc/d/dmd/templateparamsem.d
+++ b/gcc/d/dmd/templateparamsem.d
@@ -1,7 +1,7 @@ 
 /**
  * Semantic analysis of template parameters.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/templateparamsem.d, _templateparamsem.d)
diff --git a/gcc/d/dmd/tokens.d b/gcc/d/dmd/tokens.d
index 317a6e6c382..589bc2b53cd 100644
--- a/gcc/d/dmd/tokens.d
+++ b/gcc/d/dmd/tokens.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/lex.html#tokens, Tokens)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/tokens.d, _tokens.d)
@@ -947,93 +947,111 @@  nothrow:
     }
 
     extern (C++) const(char)* toChars() const
+    {
+        return toString().ptr;
+    }
+
+    /*********************************
+     * Returns:
+     *  a zero-terminated string representation of the token,
+     *  sometimes reusing a static buffer, sometimes leaking memory
+     */
+    extern (D) const(char)[] toString() const
     {
         const bufflen = 3 + 3 * floatvalue.sizeof + 1;
-        __gshared char[bufflen] buffer;
-        const(char)* p = &buffer[0];
+        __gshared char[bufflen + 2] buffer;     // extra 2 for suffixes
+        char* p = &buffer[0];
         switch (value)
         {
         case TOK.int32Literal:
-            snprintf(&buffer[0], bufflen, "%d", cast(int)intvalue);
-            break;
+            const length = snprintf(p, bufflen, "%d", cast(int)intvalue);
+            return p[0 .. length];
+
         case TOK.uns32Literal:
         case TOK.wchar_tLiteral:
-            snprintf(&buffer[0], bufflen, "%uU", cast(uint)unsvalue);
-            break;
+            const length = snprintf(p, bufflen, "%uU", cast(uint)unsvalue);
+            return p[0 .. length];
+
         case TOK.wcharLiteral:
         case TOK.dcharLiteral:
         case TOK.charLiteral:
-            {
-                OutBuffer buf;
-                buf.writeSingleCharLiteral(cast(dchar) intvalue);
-                buf.writeByte('\0');
-                p = buf.extractChars();
-            }
-            break;
+            OutBuffer buf;
+            buf.writeSingleCharLiteral(cast(dchar) intvalue);
+            return buf.extractSlice(true);
+
         case TOK.int64Literal:
-            snprintf(&buffer[0], bufflen, "%lldL", cast(long)intvalue);
-            break;
+            const length = snprintf(p, bufflen, "%lldL", cast(long)intvalue);
+            return p[0 .. length];
+
         case TOK.uns64Literal:
-            snprintf(&buffer[0], bufflen, "%lluUL", cast(ulong)unsvalue);
-            break;
+            const length = snprintf(p, bufflen, "%lluUL", cast(ulong)unsvalue);
+            return p[0 .. length];
+
         case TOK.float32Literal:
-            CTFloat.sprint(&buffer[0], bufflen, 'g', floatvalue);
-            strcat(&buffer[0], "f");
-            break;
+            const length = CTFloat.sprint(p, bufflen, 'g', floatvalue);
+            p[length] = 'f';
+            p[length + 1] = 0;
+            return p[0 .. length + 1];
+
         case TOK.float64Literal:
-            CTFloat.sprint(&buffer[0], bufflen, 'g', floatvalue);
-            break;
+            const length = CTFloat.sprint(p, bufflen, 'g', floatvalue);
+            return p[0 .. length];
+
         case TOK.float80Literal:
-            CTFloat.sprint(&buffer[0], bufflen, 'g', floatvalue);
-            strcat(&buffer[0], "L");
-            break;
+            const length = CTFloat.sprint(p, bufflen, 'g', floatvalue);
+            p[length] = 'L';
+            p[length + 1] = 0;
+            return p[0 .. length + 1];
+
         case TOK.imaginary32Literal:
-            CTFloat.sprint(&buffer[0], bufflen, 'g', floatvalue);
-            strcat(&buffer[0], "fi");
-            break;
+            const length = CTFloat.sprint(p, bufflen, 'g', floatvalue);
+            p[length    ] = 'f';
+            p[length + 1] = 'i';
+            p[length + 2] = 0;
+            return p[0 .. length + 2];
+
         case TOK.imaginary64Literal:
-            CTFloat.sprint(&buffer[0], bufflen, 'g', floatvalue);
-            strcat(&buffer[0], "i");
-            break;
+            const length = CTFloat.sprint(p, bufflen, 'g', floatvalue);
+            p[length] = 'i';
+            p[length + 1] = 0;
+            return p[0 .. length + 1];
+
         case TOK.imaginary80Literal:
-            CTFloat.sprint(&buffer[0], bufflen, 'g', floatvalue);
-            strcat(&buffer[0], "Li");
-            break;
+            const length = CTFloat.sprint(p, bufflen, 'g', floatvalue);
+            p[length    ] = 'L';
+            p[length + 1] = 'i';
+            p[length + 2] = 0;
+            return p[0 .. length + 2];
+
         case TOK.string_:
+            OutBuffer buf;
+            buf.writeByte('"');
+            for (size_t i = 0; i < len;)
             {
-                OutBuffer buf;
-                buf.writeByte('"');
-                for (size_t i = 0; i < len;)
-                {
-                    dchar c;
-                    utf_decodeChar(ustring[0 .. len], i, c);
-                    writeCharLiteral(buf, c);
-                }
-                buf.writeByte('"');
-                if (postfix)
-                    buf.writeByte(postfix);
-                buf.writeByte(0);
-                p = buf.extractChars();
+                dchar c;
+                utf_decodeChar(ustring[0 .. len], i, c);
+                writeCharLiteral(buf, c);
             }
-            break;
+            buf.writeByte('"');
+            if (postfix)
+                buf.writeByte(postfix);
+            return buf.extractSlice(true);
+
         case TOK.hexadecimalString:
+            OutBuffer buf;
+            buf.writeByte('x');
+            buf.writeByte('"');
+            foreach (size_t i; 0 .. len)
             {
-                OutBuffer buf;
-                buf.writeByte('x');
-                buf.writeByte('"');
-                foreach (size_t i; 0 .. len)
-                {
-                    if (i)
-                        buf.writeByte(' ');
-                    buf.printf("%02x", ustring[i]);
-                }
-                buf.writeByte('"');
-                if (postfix)
-                    buf.writeByte(postfix);
-                buf.writeByte(0);
-                p = buf.extractData();
-                break;
+                if (i)
+                    buf.writeByte(' ');
+                buf.printf("%02x", ustring[i]);
             }
+            buf.writeByte('"');
+            if (postfix)
+                buf.writeByte(postfix);
+            return buf.extractSlice(true);
+
         case TOK.identifier:
         case TOK.enum_:
         case TOK.struct_:
@@ -1062,13 +1080,11 @@  nothrow:
         case TOK.complex64:
         case TOK.complex80:
         case TOK.void_:
-            p = ident.toChars();
-            break;
+            return ident.toString();
+
         default:
-            p = toChars(value);
-            break;
+            return tochars[value];
         }
-        return p;
     }
 
     static const(char)* toChars(TOK value)
diff --git a/gcc/d/dmd/tokens.h b/gcc/d/dmd/tokens.h
index 560942d1e47..f944663e430 100644
--- a/gcc/d/dmd/tokens.h
+++ b/gcc/d/dmd/tokens.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/traits.d b/gcc/d/dmd/traits.d
index aebc0b5512b..c67ee816d2c 100644
--- a/gcc/d/dmd/traits.d
+++ b/gcc/d/dmd/traits.d
@@ -3,7 +3,7 @@ 
  *
  * Specification: $(LINK2 https://dlang.org/spec/traits.html, Traits)
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/traits.d, _traits.d)
diff --git a/gcc/d/dmd/typesem.d b/gcc/d/dmd/typesem.d
index b0e45f4c042..51b4ef885f1 100644
--- a/gcc/d/dmd/typesem.d
+++ b/gcc/d/dmd/typesem.d
@@ -1,7 +1,7 @@ 
 /**
  * Semantic analysis for D types.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/typesem.d, _typesem.d)
@@ -711,7 +711,15 @@  private extern(D) bool isCopyConstructorCallable (StructDeclaration argStruct,
                 s ~= "@safe ";
             if (!f.isNogc && sc.func.setGC(arg.loc, null))
                 s ~= "nogc ";
-            if (s)
+            if (f.isDisabled() && !f.isGenerated())
+            {
+                /* https://issues.dlang.org/show_bug.cgi?id=24301
+                 * Copy constructor is explicitly disabled
+                 */
+                buf.printf("`%s` copy constructor cannot be used because it is annotated with `@disable`",
+                    f.type.toChars());
+            }
+            else if (s)
             {
                 s[$-1] = '\0';
                 buf.printf("`%s` copy constructor cannot be called from a `%s` context", f.type.toChars(), s.ptr);
@@ -843,7 +851,7 @@  private extern(D) MATCH argumentMatchParameter (TypeFunction tf, Parameter p,
                     ta = tn.sarrayOf(dim);
                 }
             }
-            else if ((p.storageClass & STC.in_) && global.params.previewIn)
+            else if (p.storageClass & STC.constscoperef)
             {
                 // Allow converting a literal to an `in` which is `ref`
                 if (arg.op == EXP.arrayLiteral && tp.ty == Tsarray)
@@ -1678,7 +1686,7 @@  extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
 
             // default arg must be an lvalue
             if (isRefOrOut && !isAuto &&
-                !(global.params.previewIn && (fparam.storageClass & STC.in_)) &&
+                !(fparam.storageClass & STC.constscoperef) &&
                 global.params.rvalueRefParam != FeatureState.enabled)
                 e = e.toLvalue(sc, "create default argument for `ref` / `out` parameter from");
 
@@ -1784,13 +1792,13 @@  extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
                     switch (tf.linkage)
                     {
                     case LINK.cpp:
-                        if (global.params.previewIn)
+                        if (fparam.storageClass & STC.constscoperef)
                             fparam.storageClass |= STC.ref_;
                         break;
                     case LINK.default_, LINK.d:
                         break;
                     default:
-                        if (global.params.previewIn)
+                        if (fparam.storageClass & STC.constscoperef)
                         {
                             .error(loc, "cannot use `in` parameters with `extern(%s)` functions",
                                    linkageToChars(tf.linkage));
@@ -1820,7 +1828,7 @@  extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
                     if (tb2.ty == Tstruct && !tb2.isTypeStruct().sym.members ||
                         tb2.ty == Tenum   && !tb2.isTypeEnum().sym.memtype)
                     {
-                        if (global.params.previewIn && (fparam.storageClass & STC.in_))
+                        if (fparam.storageClass & STC.constscoperef)
                         {
                             .error(loc, "cannot infer `ref` for `in` parameter `%s` of opaque type `%s`",
                                    fparam.toChars(), fparam.type.toChars());
@@ -1902,7 +1910,7 @@  extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
                 fparam.storageClass &= ~(STC.TYPECTOR);
 
                 // -preview=in: add `ref` storage class to suited `in` params
-                if (global.params.previewIn && (fparam.storageClass & (STC.in_ | STC.ref_)) == STC.in_)
+                if ((fparam.storageClass & (STC.constscoperef | STC.ref_)) == STC.constscoperef)
                 {
                     auto ts = t.baseElemOf().isTypeStruct();
                     const isPOD = !ts || ts.sym.isPOD();
@@ -2318,11 +2326,16 @@  extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
     Type visitTag(TypeTag mtype)
     {
         //printf("TypeTag.semantic() %s\n", mtype.toChars());
+        Type returnType(Type t)
+        {
+            return t.deco ? t : t.merge();
+        }
+
         if (mtype.resolved)
         {
             /* struct S s, *p;
              */
-            return mtype.resolved.addSTC(mtype.mod);
+            return returnType(mtype.resolved.addSTC(mtype.mod));
         }
 
         /* Find the current scope by skipping tag scopes.
@@ -2395,7 +2408,7 @@  extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
         {
             mtype.id = Identifier.generateId("__tag"[]);
             declareTag();
-            return mtype.resolved.addSTC(mtype.mod);
+            return returnType(mtype.resolved.addSTC(mtype.mod));
         }
 
         /* look for pre-existing declaration
@@ -2408,7 +2421,7 @@  extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
             if (mtype.tok == TOK.enum_ && !mtype.members)
                 .error(mtype.loc, "`enum %s` is incomplete without members", mtype.id.toChars()); // C11 6.7.2.3-3
             declareTag();
-            return mtype.resolved.addSTC(mtype.mod);
+            return returnType(mtype.resolved.addSTC(mtype.mod));
         }
 
         /* A redeclaration only happens if both declarations are in
@@ -2508,7 +2521,7 @@  extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
                 declareTag();
             }
         }
-        return mtype.resolved.addSTC(mtype.mod);
+        return returnType(mtype.resolved.addSTC(mtype.mod));
     }
 
     switch (type.ty)
diff --git a/gcc/d/dmd/typinf.d b/gcc/d/dmd/typinf.d
index 485ca3ff66c..9e062bd631d 100644
--- a/gcc/d/dmd/typinf.d
+++ b/gcc/d/dmd/typinf.d
@@ -1,7 +1,7 @@ 
 /**
  * Generate `TypeInfo` objects, which are needed for run-time introspection of types.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/typinf.d, _typinf.d)
diff --git a/gcc/d/dmd/typinf.h b/gcc/d/dmd/typinf.h
index 76f623a0a3e..fe80b94b4e1 100644
--- a/gcc/d/dmd/typinf.h
+++ b/gcc/d/dmd/typinf.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/utils.d b/gcc/d/dmd/utils.d
index bb389b65903..75ee78cdd2e 100644
--- a/gcc/d/dmd/utils.d
+++ b/gcc/d/dmd/utils.d
@@ -1,7 +1,7 @@ 
 /**
  * This module defines some utility functions for DMD.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/utils.d, _utils.d)
diff --git a/gcc/d/dmd/version.h b/gcc/d/dmd/version.h
index c268bc9b8cf..dd83fd67dff 100644
--- a/gcc/d/dmd/version.h
+++ b/gcc/d/dmd/version.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * written by Walter Bright
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
diff --git a/gcc/d/dmd/visitor.d b/gcc/d/dmd/visitor.d
index 5722e10d256..abfd8caa584 100644
--- a/gcc/d/dmd/visitor.d
+++ b/gcc/d/dmd/visitor.d
@@ -1,7 +1,7 @@ 
 /**
  * Provides a visitor class visiting all AST nodes present in the compiler.
  *
- * Copyright:   Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright:   Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
  * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
  * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/visitor.d, _visitor.d)
diff --git a/gcc/d/dmd/visitor.h b/gcc/d/dmd/visitor.h
index 360784a1076..7fa08cb0e8b 100644
--- a/gcc/d/dmd/visitor.h
+++ b/gcc/d/dmd/visitor.h
@@ -1,6 +1,6 @@ 
 
 /* Compiler implementation of the D programming language
- * Copyright (C) 2013-2023 by The D Language Foundation, All Rights Reserved
+ * Copyright (C) 2013-2024 by The D Language Foundation, All Rights Reserved
  * https://www.digitalmars.com
  * Distributed under the Boost Software License, Version 1.0.
  * https://www.boost.org/LICENSE_1_0.txt
diff --git a/gcc/d/modules.cc b/gcc/d/modules.cc
index 16b67338f63..58b15beba34 100644
--- a/gcc/d/modules.cc
+++ b/gcc/d/modules.cc
@@ -84,6 +84,7 @@  struct module_info
   vec <tree, va_gc> *sharedctors;
   vec <tree, va_gc> *shareddtors;
   vec <tree, va_gc> *sharedctorgates;
+  vec <tree, va_gc> *standalonectors;
 
   vec <tree, va_gc> *unitTests;
 };
@@ -763,6 +764,11 @@  build_module_tree (Module *decl)
 	tm->sdtor = build_funcs_gates_fn (get_identifier ("*__modtestdtor"),
 					  mitest.dtors, NULL);
 
+      if (mi.standalonectors)
+	tm->sictor
+	  = build_funcs_gates_fn (get_identifier ("*__modtestsharedictor"),
+				  mi.standalonectors, NULL);
+
       if (mitest.sharedctors || mitest.sharedctorgates)
 	tm->ssharedctor
 	  = build_funcs_gates_fn (get_identifier ("*__modtestsharedctor"),
@@ -793,6 +799,11 @@  build_module_tree (Module *decl)
 	decl->sdtor = build_funcs_gates_fn (get_identifier ("*__moddtor"),
 					    mi.dtors, NULL);
 
+      if (mi.standalonectors)
+	decl->sictor
+	  = build_funcs_gates_fn (get_identifier ("*__modsharedictor"),
+				  mi.standalonectors, NULL);
+
       if (mi.sharedctors || mi.sharedctorgates)
 	decl->ssharedctor
 	  = build_funcs_gates_fn (get_identifier ("*__modsharedctor"),
@@ -858,8 +869,15 @@  register_module_decl (Declaration *d)
       /* If a static constructor, push into the current ModuleInfo.
 	 Checks for `shared' first because it derives from the non-shared
 	 constructor type in the front-end.  */
-      if (fd->isSharedStaticCtorDeclaration ())
-	vec_safe_push (minfo->sharedctors, decl);
+      if (SharedStaticCtorDeclaration *sctor
+	  = fd->isSharedStaticCtorDeclaration ())
+	{
+	  /* The `shared' static constructor was marked `@standalone'.  */
+	  if (sctor->standalone)
+	    vec_safe_push (minfo->standalonectors, decl);
+	  else
+	    vec_safe_push (minfo->sharedctors, decl);
+	}
       else if (fd->isStaticCtorDeclaration ())
 	vec_safe_push (minfo->ctors, decl);
 
diff --git a/gcc/testsuite/gdc.test/compilable/issue20339.d b/gcc/testsuite/gdc.test/compilable/issue20339.d
new file mode 100644
index 00000000000..3d5bdd80a02
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/issue20339.d
@@ -0,0 +1,44 @@ 
+/*
+TEST_OUTPUT:
+---
+4
+false
+false
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=20339
+
+struct S
+{
+    pragma(msg, cast(int)S.sizeof);
+
+    this(this){}
+    ~this(){}
+
+    int f;
+}
+
+static assert(__traits(isPOD, S) == false);
+
+
+pragma(msg, __traits(isPOD, T));
+
+struct T
+{
+    this(this){}
+    ~this(){}
+}
+
+static assert(__traits(isPOD, T) == false);
+
+
+struct U
+{
+    pragma(msg, __traits(isPOD, U));
+
+    this(this){}
+    ~this(){}
+}
+
+static assert(__traits(isPOD, U) == false);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/array_bool.d b/gcc/testsuite/gdc.test/fail_compilation/array_bool.d
new file mode 100644
index 00000000000..923766a93fe
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/array_bool.d
@@ -0,0 +1,22 @@ 
+/*
+REQUIRED_ARGS: -de
+TEST_OUTPUT:
+---
+fail_compilation/array_bool.d(13): Deprecation: assert condition cannot be a string literal
+fail_compilation/array_bool.d(13):        If intentional, use `"foo" !is null` instead to preserve behaviour
+fail_compilation/array_bool.d(14): Deprecation: static assert condition cannot be a string literal
+fail_compilation/array_bool.d(14):        If intentional, use `"foo" !is null` instead to preserve behaviour
+---
+*/
+void main()
+{
+    assert("foo");
+    static assert("foo");
+
+    assert("foo".ptr); // OK
+    static assert("foo".ptr); // OK
+
+    enum e = "bar";
+    static assert(e); // OK
+    assert(e); // OK
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11425.d b/gcc/testsuite/gdc.test/fail_compilation/diag11425.d
index f8edc5c7867..dfcddaa5f67 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/diag11425.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/diag11425.d
@@ -1,7 +1,8 @@ 
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/diag11425.d(13): Error: variable `x` is shadowing variable `diag11425.main.x`
+fail_compilation/diag11425.d(14): Error: variable `x` is shadowing variable `diag11425.main.x`
+fail_compilation/diag11425.d(11):        declared here
 ---
 */
 
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diagin.d b/gcc/testsuite/gdc.test/fail_compilation/diagin.d
index 1748e92a841..5b8e33162cd 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/diagin.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/diagin.d
@@ -1,5 +1,5 @@ 
 /*
-PERMUTE_ARGS: -preview=in
+REQUIRED_ARGS: -preview=in
 TEST_OUTPUT:
 ---
 fail_compilation/diagin.d(14): Error: function `diagin.foo(in int)` is not callable using argument types `()`
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail110.d b/gcc/testsuite/gdc.test/fail_compilation/fail110.d
index a13922b0fde..4ba2a8c487e 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail110.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail110.d
@@ -1,9 +1,12 @@ 
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/fail110.d(16): Error: variable `i` is shadowing variable `fail110.main.i`
-fail_compilation/fail110.d(17): Error: variable `i` is shadowing variable `fail110.main.i`
-fail_compilation/fail110.d(18): Error: variable `i` is shadowing variable `fail110.main.i`
+fail_compilation/fail110.d(19): Error: variable `i` is shadowing variable `fail110.main.i`
+fail_compilation/fail110.d(17):        declared here
+fail_compilation/fail110.d(20): Error: variable `i` is shadowing variable `fail110.main.i`
+fail_compilation/fail110.d(17):        declared here
+fail_compilation/fail110.d(21): Error: variable `i` is shadowing variable `fail110.main.i`
+fail_compilation/fail110.d(17):        declared here
 ---
 */
 
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19890a.d b/gcc/testsuite/gdc.test/fail_compilation/fail19890a.d
index 9b984961f33..2e8e4e6ae9c 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail19890a.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail19890a.d
@@ -1,7 +1,7 @@ 
-/*
+/* REQUIRED_ARGS: -m32
 TEST_OUTPUT:
 ---
-fail_compilation/fail19890a.d(8): Error: `void[$n$$?:64=LU$]` size 1 * $n$ exceeds $?:windows+32omf=0x1000000|0x7fffffff$ size limit for static array
+fail_compilation/fail19890a.d(8): Error: `void[cast(size_t)4294967295]` size 1 * 4294967295 exceeds 0x7fffffff size limit for static array
 ---
 */
 
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19890b.d b/gcc/testsuite/gdc.test/fail_compilation/fail19890b.d
index 19081d95871..f9cfb45d533 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail19890b.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail19890b.d
@@ -1,7 +1,7 @@ 
-/*
+/* REQUIRED_ARGS: -m32
 TEST_OUTPUT:
 ---
-fail_compilation/fail19890b.d(8): Error: `void[$n$$?:64=LU$]` size 1 * $n$ exceeds $?:windows+32omf=0x1000000|0x7fffffff$ size limit for static array
+fail_compilation/fail19890b.d(8): Error: `void[cast(size_t)4294967294]` size 1 * 4294967294 exceeds 0x7fffffff size limit for static array
 ---
 */
 
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail2195.d b/gcc/testsuite/gdc.test/fail_compilation/fail2195.d
index 0eff0663d4b..6f6cd53b0e3 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail2195.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail2195.d
@@ -3,7 +3,8 @@ 
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/fail2195.d(16): Deprecation: variable `variable` is shadowing variable `fail2195.main.variable`. Rename the `foreach` variable.
+fail_compilation/fail2195.d(17): Deprecation: variable `variable` is shadowing variable `fail2195.main.variable`
+fail_compilation/fail2195.d(14):        declared here
 ---
 */
 
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail24301.d b/gcc/testsuite/gdc.test/fail_compilation/fail24301.d
new file mode 100644
index 00000000000..be09c883e1c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail24301.d
@@ -0,0 +1,19 @@ 
+/+
+TEST_OUTPUT:
+---
+fail_compilation/fail24301.d(18): Error: function `fail24301.fun(S __param_0)` is not callable using argument types `(S)`
+fail_compilation/fail24301.d(18):        `ref S(ref S)` copy constructor cannot be used because it is annotated with `@disable`
+---
++/
+struct S
+{
+    @disable this(ref S);
+}
+
+@safe void fun(S) {}
+
+@safe void main()
+{
+    S s;
+    fun(s);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail4611.d b/gcc/testsuite/gdc.test/fail_compilation/fail4611.d
index 04adf13f5e7..259a6da847d 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail4611.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail4611.d
@@ -1,7 +1,7 @@ 
-/*
+/* REQUIRED_ARGS: -m32
 TEST_OUTPUT:
 ---
-fail_compilation/fail4611.d(15): Error: `Vec[$n$]` size 4 * $n$ exceeds $?:windows+32omf=0x1000000|0x7fffffff$ size limit for static array
+fail_compilation/fail4611.d(15): Error: `Vec[cast(size_t)2147483647]` size 4 * 2147483647 exceeds 0x7fffffff size limit for static array
 ---
 */
 
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail93.d b/gcc/testsuite/gdc.test/fail_compilation/fail93.d
index b9ad2941be7..29893959b17 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/fail93.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail93.d
@@ -1,7 +1,8 @@ 
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/fail93.d(13): Error: variable `i` is shadowing variable `fail93.main.i`
+fail_compilation/fail93.d(14): Error: variable `i` is shadowing variable `fail93.main.i`
+fail_compilation/fail93.d(13):        declared here
 ---
 */
 
diff --git a/gcc/testsuite/gdc.test/fail_compilation/standalone_modctor.d b/gcc/testsuite/gdc.test/fail_compilation/standalone_modctor.d
new file mode 100644
index 00000000000..cb36ed6b790
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/standalone_modctor.d
@@ -0,0 +1,15 @@ 
+/**
+TEST_OUTPUT:
+---
+fail_compilation/standalone_modctor.d(11): Error: `@standalone` can only be used on shared static constructors
+fail_compilation/standalone_modctor.d(12): Error: a module constructor using `@standalone` must be `@system` or `@trusted`
+fail_compilation/standalone_modctor.d(13): Error: a module constructor using `@standalone` must be `@system` or `@trusted`
+---
+*/
+import core.attribute : standalone;
+
+@standalone        static this() {}
+@standalone shared static this() {}
+@standalone shared static this() @safe {}
+@standalone shared static this() @trusted {}
+@standalone shared static this() @system {}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/staticarrayoverflow.d b/gcc/testsuite/gdc.test/fail_compilation/staticarrayoverflow.d
index 1305bc55351..028f8e12487 100644
--- a/gcc/testsuite/gdc.test/fail_compilation/staticarrayoverflow.d
+++ b/gcc/testsuite/gdc.test/fail_compilation/staticarrayoverflow.d
@@ -2,13 +2,13 @@ 
 REQUIRED_ARGS: -m64
 TEST_OUTPUT:
 ---
-fail_compilation/staticarrayoverflow.d(23): Error: static array `S[1879048192]` size overflowed to 7516192768000
+fail_compilation/staticarrayoverflow.d(23): Error: static array `S[cast(size_t)1879048192]` size overflowed to 7516192768000
 fail_compilation/staticarrayoverflow.d(23): Error: variable `staticarrayoverflow.y` size overflow
-fail_compilation/staticarrayoverflow.d(25): Error: static array `S[8070450532247928832]` size overflowed to 8070450532247928832
+fail_compilation/staticarrayoverflow.d(25): Error: static array `S[cast(size_t)8070450532247928832]` size overflowed to 8070450532247928832
 fail_compilation/staticarrayoverflow.d(25): Error: variable `staticarrayoverflow.a` size overflow
 fail_compilation/staticarrayoverflow.d(26): Error: static array `S[0][18446744073709551615LU]` size overflowed to 18446744073709551615
 fail_compilation/staticarrayoverflow.d(26): Error: variable `staticarrayoverflow.b` size overflow
-fail_compilation/staticarrayoverflow.d(27): Error: static array `S[0][4294967295]` size overflowed to 4294967295
+fail_compilation/staticarrayoverflow.d(27): Error: static array `S[0][cast(size_t)4294967295]` size overflowed to 4294967295
 fail_compilation/staticarrayoverflow.d(27): Error: variable `staticarrayoverflow.c` size overflow
 ---
 */
diff --git a/gcc/testsuite/gdc.test/runnable/imports/standalone_b.d b/gcc/testsuite/gdc.test/runnable/imports/standalone_b.d
new file mode 100644
index 00000000000..bc5500b7b8c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/imports/standalone_b.d
@@ -0,0 +1,11 @@ 
+module standalone_b;
+
+import standalone_modctor;
+import core.attribute : standalone;
+
+immutable int* y;
+
+@standalone @system shared static this()
+{
+    y = new int(2);
+}
diff --git a/gcc/testsuite/gdc.test/runnable/standalone_modctor.d b/gcc/testsuite/gdc.test/runnable/standalone_modctor.d
new file mode 100644
index 00000000000..26544076836
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable/standalone_modctor.d
@@ -0,0 +1,19 @@ 
+// REQUIRED_ARGS: -Irunnable/imports
+// EXTRA_SOURCES: imports/standalone_b.d
+// PERMUTE_ARGS: -cov
+
+import standalone_b;
+import core.attribute : standalone;
+
+immutable int* x;
+
+@standalone @system shared static this()
+{
+    x = new int(1);
+}
+
+void main()
+{
+    assert(*x == 1);
+    assert(*y == 2);
+}
diff --git a/gcc/testsuite/gdc.test/runnable_cxx/extra-files/test24292.cpp b/gcc/testsuite/gdc.test/runnable_cxx/extra-files/test24292.cpp
new file mode 100644
index 00000000000..2fab9afbbd8
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable_cxx/extra-files/test24292.cpp
@@ -0,0 +1,46 @@ 
+template<class T>
+struct List
+{
+    T* begin;
+};
+
+struct StructWithDestructor
+{
+    ~StructWithDestructor();
+
+    int i;
+};
+
+struct StructWithCopyCtor
+{
+    StructWithCopyCtor();
+    StructWithCopyCtor(const StructWithCopyCtor &other);
+
+    int i;
+};
+
+StructWithDestructor::~StructWithDestructor()
+{
+}
+
+StructWithCopyCtor::StructWithCopyCtor()
+{
+}
+
+StructWithCopyCtor::StructWithCopyCtor(const StructWithCopyCtor &other) : i(other.i)
+{
+}
+
+StructWithDestructor getStructWithDestructor()
+{
+    StructWithDestructor r;
+    r.i = 12345;
+    return r;
+}
+
+StructWithCopyCtor getStructWithCopyCtor()
+{
+    StructWithCopyCtor r;
+    r.i = 54321;
+    return r;
+}
diff --git a/gcc/testsuite/gdc.test/runnable_cxx/test24292.d b/gcc/testsuite/gdc.test/runnable_cxx/test24292.d
new file mode 100644
index 00000000000..b71f925639c
--- /dev/null
+++ b/gcc/testsuite/gdc.test/runnable_cxx/test24292.d
@@ -0,0 +1,50 @@ 
+// EXTRA_CPP_SOURCES: test24292.cpp
+
+extern(C++) struct List(T)
+{
+    // Any of the following static ifs can trigger the problem.
+    static if (T.sizeof > 4) {}
+    static if (__traits(isZeroInit, T)) {}
+    static if (__traits(isPOD, T)) {}
+
+    T* begin;
+}
+
+extern(C++) struct StructWithDestructor
+{
+    ~this();
+
+    alias L = List!StructWithDestructor;
+    int i;
+}
+
+extern(C++) struct StructWithCopyCtor
+{
+    this(ref const(StructWithCopyCtor));
+
+    alias L = List!StructWithCopyCtor;
+    int i;
+}
+
+extern(D) struct StructWithPostblit
+{
+    this(this) {}
+
+    alias L = List!StructWithPostblit;
+    int i;
+}
+
+static assert(!__traits(isPOD, StructWithDestructor));
+static assert(!__traits(isPOD, StructWithCopyCtor));
+static assert(!__traits(isPOD, StructWithPostblit));
+
+extern(C++) StructWithDestructor getStructWithDestructor();
+extern(C++) StructWithCopyCtor getStructWithCopyCtor();
+
+void main()
+{
+    StructWithDestructor structWithDestructor = getStructWithDestructor();
+    assert(structWithDestructor.i == 12345);
+    StructWithCopyCtor structWithCopyCtor = getStructWithCopyCtor();
+    assert(structWithCopyCtor.i == 54321);
+}
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index fa7004b7a41..2b4400f398e 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@ 
-f1a045928e03239b9477f9497f43f2cf0e61e959
+d8e3976a58d6aef7c2c9371028a2ca4460b5b2ce
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/dmd repository.
diff --git a/libphobos/libdruntime/__builtins.di b/libphobos/libdruntime/__builtins.di
index 74147a095cd..b4fef091b5f 100644
--- a/libphobos/libdruntime/__builtins.di
+++ b/libphobos/libdruntime/__builtins.di
@@ -53,6 +53,10 @@  version (CRuntime_Microsoft)
 
 version (DigitalMars)
 {
+    immutable float __nan = float.nan;
+
+    float __builtin_nanf()(char*)  { return float.nan; }
+
     double __builtin_inf()()  { return double.infinity; }
     float  __builtin_inff()() { return float.infinity; }
     real   __builtin_infl()() { return real.infinity; }
diff --git a/libphobos/libdruntime/core/attribute.d b/libphobos/libdruntime/core/attribute.d
index c2a7c334eb7..79ad25ab358 100644
--- a/libphobos/libdruntime/core/attribute.d
+++ b/libphobos/libdruntime/core/attribute.d
@@ -290,3 +290,15 @@  version (UdaGNUAbiTag) struct gnuAbiTag
  * ---
  */
 enum mustuse;
+
+/**
+ * Use this attribute to indicate that a shared module constructor does not depend on any
+ * other module constructor being run first. This avoids errors on cyclic module constructors.
+ *
+ * However, it is now up to the user to enforce safety.
+ * The module constructor must be marked `@system` as a result.
+ * Prefer to refactor the module constructor causing the cycle so it's in its own module if possible.
+ *
+ * This is only allowed on `shared` static constructors, not thread-local module constructors.
+ */
+enum standalone;
diff --git a/libphobos/libdruntime/core/math.d b/libphobos/libdruntime/core/math.d
index 30fc1308e4b..941b5de3c4e 100644
--- a/libphobos/libdruntime/core/math.d
+++ b/libphobos/libdruntime/core/math.d
@@ -30,15 +30,6 @@  public:
 nothrow:
 @safe:
 
-/*****************************************
- * Returns x rounded to a long value using the FE_TONEAREST rounding mode.
- * If the integer value of x is
- * greater than long.max, the result is
- * indeterminate.
- */
-deprecated("rndtonl is to be removed by 2.100. Please use round instead")
-extern (C) real rndtonl(real x);
-
 pure:
 /***********************************
  * Returns cosine of x. x is in radians.
diff --git a/libphobos/libdruntime/core/stdcpp/new_.d b/libphobos/libdruntime/core/stdcpp/new_.d
index 6a598baec28..de9e10ac47c 100644
--- a/libphobos/libdruntime/core/stdcpp/new_.d
+++ b/libphobos/libdruntime/core/stdcpp/new_.d
@@ -59,6 +59,8 @@  T cpp_new(T, Args...)(auto ref Args args) if (is(T == class))
 ///
 void cpp_delete(T)(T* ptr) if (!is(T == class))
 {
+    if (ptr is null)
+        return;
     destroy!false(*ptr);
     __cpp_delete(ptr);
 }
@@ -66,6 +68,8 @@  void cpp_delete(T)(T* ptr) if (!is(T == class))
 ///
 void cpp_delete(T)(T instance) if (is(T == class))
 {
+    if (instance is null)
+        return;
     destroy!false(instance);
     __cpp_delete(cast(void*) instance);
 }
diff --git a/libphobos/libdruntime/core/sys/posix/net/if_.d b/libphobos/libdruntime/core/sys/posix/net/if_.d
index e63af4f7c32..7fadcd884c4 100644
--- a/libphobos/libdruntime/core/sys/posix/net/if_.d
+++ b/libphobos/libdruntime/core/sys/posix/net/if_.d
@@ -143,6 +143,21 @@  else version (CRuntime_Bionic)
     uint            if_nametoindex(const scope char*);
     char*           if_indextoname(uint, char*);
 }
+else version (CRuntime_Musl)
+{
+    struct if_nameindex_t
+    {
+        uint    if_index;
+        char*   if_name;
+    }
+
+    enum IF_NAMESIZE = 16;
+
+    uint            if_nametoindex(const scope char*);
+    char*           if_indextoname(uint, char*);
+    if_nameindex_t* if_nameindex();
+    void            if_freenameindex(if_nameindex_t*);
+}
 else version (CRuntime_UClibc)
 {
     struct if_nameindex_t
@@ -157,4 +172,4 @@  else version (CRuntime_UClibc)
     char*           if_indextoname(uint, char*);
     if_nameindex_t* if_nameindex();
     void            if_freenameindex(if_nameindex_t*);
-}
\ No newline at end of file
+}
diff --git a/libphobos/libdruntime/rt/sections.d b/libphobos/libdruntime/rt/sections.d
index 006d48d97f5..65f57892ee7 100644
--- a/libphobos/libdruntime/rt/sections.d
+++ b/libphobos/libdruntime/rt/sections.d
@@ -85,7 +85,10 @@  static assert(is(typeof(&initTLSRanges) RT == return) &&
               is(typeof(&finiTLSRanges) == void function(RT) nothrow @nogc) &&
               is(typeof(&scanTLSRanges) == void function(RT, scope void delegate(void*, void*) nothrow) nothrow));
 
-version (Shared)
+version (Windows)
+{
+}
+else version (Shared)
 {
     static assert(is(typeof(&pinLoadedLibraries) == void* function() nothrow @nogc));
     static assert(is(typeof(&unpinLoadedLibraries) == void function(void*) nothrow @nogc));
diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE
index 3c0e1b28d31..103a93f5ad6 100644
--- a/libphobos/src/MERGE
+++ b/libphobos/src/MERGE
@@ -1,4 +1,4 @@ 
-b64bfbf911fcd1675ae9792545649c9d45bb907e
+7a6e9568862f5a0d9eb34707d85dcf7ff889c26f
 
 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/std/conv.d b/libphobos/src/std/conv.d
index 3a533814894..23b33c4d78c 100644
--- a/libphobos/src/std/conv.d
+++ b/libphobos/src/std/conv.d
@@ -5712,8 +5712,8 @@  private auto hexStrLiteral(String)(scope String hexData)
  *      radix = 2, 8, 10, 16
  *      Char = character type for output
  *      letterCase = lower for deadbeef, upper for DEADBEEF
- *      value = integer to convert. Can be uint or ulong. If radix is 10, can also be
- *              int or long.
+ *      value = integer to convert. Can be ubyte, ushort, uint or ulong. If radix
+ *              is 10, can also be byte, short, int or long.
  * Returns:
  *      Random access range with slicing and everything
  */
@@ -5721,8 +5721,7 @@  private auto hexStrLiteral(String)(scope String hexData)
 auto toChars(ubyte radix = 10, Char = char, LetterCase letterCase = LetterCase.lower, T)(T value)
     pure nothrow @nogc @safe
 if ((radix == 2 || radix == 8 || radix == 10 || radix == 16) &&
-    (is(immutable T == immutable uint) || is(immutable T == immutable ulong) ||
-    radix == 10 && (is(immutable T == immutable int) || is(immutable T == immutable long))))
+        isIntegral!T && (radix == 10 || isUnsigned!T))
 {
     alias UT = Unqual!T;
 
@@ -5870,8 +5869,12 @@  if ((radix == 2 || radix == 8 || radix == 10 || radix == 16) &&
     assert(toChars(123) == toChars(123));
 
     {
+        assert(toChars!2(ubyte(0)).array == "0");
+        assert(toChars!2(ushort(0)).array == "0");
         assert(toChars!2(0u).array == "0");
         assert(toChars!2(0Lu).array == "0");
+        assert(toChars!2(ubyte(1)).array == "1");
+        assert(toChars!2(ushort(1)).array == "1");
         assert(toChars!2(1u).array == "1");
         assert(toChars!2(1Lu).array == "1");
 
@@ -5884,10 +5887,14 @@  if ((radix == 2 || radix == 8 || radix == 10 || radix == 16) &&
         assert(s.retro.array == "01");
     }
     {
+        assert(toChars!8(ubyte(0)).array == "0");
+        assert(toChars!8(ushort(0)).array == "0");
         assert(toChars!8(0u).array == "0");
         assert(toChars!8(0Lu).array == "0");
         assert(toChars!8(1u).array == "1");
         assert(toChars!8(1234567Lu).array == "4553207");
+        assert(toChars!8(ubyte.max).array == "377");
+        assert(toChars!8(ushort.max).array == "177777");
 
         auto r = toChars!8(8u);
         assert(r.length == 2);
@@ -5898,10 +5905,14 @@  if ((radix == 2 || radix == 8 || radix == 10 || radix == 16) &&
         assert(s.retro.array == "01");
     }
     {
+        assert(toChars!10(ubyte(0)).array == "0");
+        assert(toChars!10(ushort(0)).array == "0");
         assert(toChars!10(0u).array == "0");
         assert(toChars!10(0Lu).array == "0");
         assert(toChars!10(1u).array == "1");
         assert(toChars!10(1234567Lu).array == "1234567");
+        assert(toChars!10(ubyte.max).array == "255");
+        assert(toChars!10(ushort.max).array == "65535");
         assert(toChars!10(uint.max).array == "4294967295");
         assert(toChars!10(ulong.max).array == "18446744073709551615");
 
@@ -5918,10 +5929,16 @@  if ((radix == 2 || radix == 8 || radix == 10 || radix == 16) &&
         assert(toChars!10(0L).array == "0");
         assert(toChars!10(1).array == "1");
         assert(toChars!10(1234567L).array == "1234567");
+        assert(toChars!10(byte.max).array == "127");
+        assert(toChars!10(short.max).array == "32767");
         assert(toChars!10(int.max).array == "2147483647");
         assert(toChars!10(long.max).array == "9223372036854775807");
+        assert(toChars!10(-byte.max).array == "-127");
+        assert(toChars!10(-short.max).array == "-32767");
         assert(toChars!10(-int.max).array == "-2147483647");
         assert(toChars!10(-long.max).array == "-9223372036854775807");
+        assert(toChars!10(byte.min).array == "-128");
+        assert(toChars!10(short.min).array == "-32768");
         assert(toChars!10(int.min).array == "-2147483648");
         assert(toChars!10(long.min).array == "-9223372036854775808");
 
@@ -5938,6 +5955,10 @@  if ((radix == 2 || radix == 8 || radix == 10 || radix == 16) &&
         assert(toChars!(16)(0Lu).array == "0");
         assert(toChars!(16)(10u).array == "a");
         assert(toChars!(16, char, LetterCase.upper)(0x12AF34567Lu).array == "12AF34567");
+        assert(toChars!(16)(ubyte(0)).array == "0");
+        assert(toChars!(16)(ushort(0)).array == "0");
+        assert(toChars!(16)(ubyte.max).array == "ff");
+        assert(toChars!(16)(ushort.max).array == "ffff");
 
         auto r = toChars!(16)(16u);
         assert(r.length == 2);
diff --git a/libphobos/src/std/datetime/package.d b/libphobos/src/std/datetime/package.d
index 8e9f5ae83be..58e71e5aa08 100644
--- a/libphobos/src/std/datetime/package.d
+++ b/libphobos/src/std/datetime/package.d
@@ -12,6 +12,7 @@ 
     $(TR
         $(TD Points in Time)
         $(TD
+            $(REF_ALTTEXT Clock, Clock, std, datetime, systime)$(NBSP)
             $(REF_ALTTEXT Date, Date, std, datetime, date)$(NBSP)
             $(REF_ALTTEXT TimeOfDay, TimeOfDay, std, datetime, date)$(NBSP)
             $(REF_ALTTEXT DateTime, DateTime, std, datetime, date)$(NBSP)
@@ -19,7 +20,7 @@ 
         )
     )
     $(TR
-        $(TD Timezones)
+        $(TD $(MREF_ALTTEXT Timezones, std, datetime, timezone))
         $(TD
             $(REF_ALTTEXT TimeZone, TimeZone, std, datetime, timezone)$(NBSP)
             $(REF_ALTTEXT UTC, UTC, std, datetime, timezone)$(NBSP)
@@ -38,7 +39,7 @@ 
         )
     )
     $(TR
-        $(TD Durations of Time)
+        $(TD $(MREF_ALTTEXT Durations of Time, core, time))
         $(TD
             $(REF_ALTTEXT Duration, Duration, core, time)$(NBSP)
             $(REF_ALTTEXT weeks, weeks, core, time)$(NBSP)
@@ -62,7 +63,7 @@ 
     )
     ))
 
-    This functionality is separated into the following modules
+    This functionality is separated into the following modules:
 
     $(UL
         $(LI $(MREF std, datetime, date) for points in time without timezones.)
@@ -73,6 +74,7 @@ 
     )
 
     See_Also:
+        $(MREF core, time)$(BR)
         $(DDLINK intro-to-datetime, Introduction to std.datetime,
                  Introduction to std&#46;datetime)<br>
         $(HTTP en.wikipedia.org/wiki/ISO_8601, ISO 8601)<br>
@@ -87,7 +89,7 @@ 
 +/
 module std.datetime;
 
-/// Get the current time from the system clock
+/// Get the current time from the system clock.
 @safe unittest
 {
     import std.datetime.systime : SysTime, Clock;
diff --git a/libphobos/src/std/datetime/systime.d b/libphobos/src/std/datetime/systime.d
index 6898934f809..a1d8ef3604f 100644
--- a/libphobos/src/std/datetime/systime.d
+++ b/libphobos/src/std/datetime/systime.d
@@ -2,7 +2,6 @@ 
 
 /++
 
-$(SCRIPT inhibitQuickIndex = 1;)
 $(DIVC quickindex,
 $(BOOKTABLE,
 $(TR $(TH Category) $(TH Functions))
@@ -468,30 +467,38 @@  private:
     `SysTime` (though for local time applications, time zones can be ignored
     and it will work, since it defaults to using the local time zone). It holds
     its internal time in std time (hnsecs since midnight, January 1st, 1 A.D.
-    UTC), so it interfaces well with the system time. However, that means that,
-    unlike $(REF DateTime,std,datetime,date), it is not optimized for
-    calendar-based operations, and getting individual units from it such as
-    years or days is going to involve conversions and be less efficient.
+    UTC), so it interfaces well with the system time.
 
     An $(I hnsec) (hecto-nanosecond) is 100 nanoseconds. There are 10,000,000 hnsecs in a second.
 
+$(PANEL
+    Unlike $(REF_SHORT DateTime,std,datetime,date), `SysTime` is not optimized for
+    calendar-based operations, and getting individual units from it such as
+    years or days is going to involve conversions and be less efficient.
+
     For calendar-based operations that don't
-    care about time zones, then $(REF DateTime,std,datetime,date) would be
+    care about time zones, then $(REF_SHORT DateTime,std,datetime,date) would be
     the type to use. For system time, use `SysTime`.
-
-    $(LREF Clock.currTime) will return the current time as a `SysTime`.
-    To convert a `SysTime` to a $(REF Date,std,datetime,date) or
-    $(REF DateTime,std,datetime,date), simply cast it. To convert a
-    $(REF Date,std,datetime,date) or $(REF DateTime,std,datetime,date) to a
+)
+$(P
+    Casting a `SysTime` to one of the following types will perform a conversion:
+)
+    * $(REF Date,std,datetime,date)
+    * $(REF_SHORT DateTime,std,datetime,date)
+    * $(REF_SHORT TimeOfDay,std,datetime,date)
+$(P
+    To convert a
+    $(REF_SHORT Date,std,datetime,date) or $(REF_SHORT DateTime,std,datetime,date) to a
     `SysTime`, use `SysTime`'s constructor, and pass in the intended time
     zone with it (or don't pass in a $(REF TimeZone,std,datetime,timezone), and
     the local time zone will be used). Be aware, however, that converting from a
-    $(REF DateTime,std,datetime,date) to a `SysTime` will not necessarily
+    $(REF_SHORT DateTime,std,datetime,date) to a `SysTime` will not necessarily
     be 100% accurate due to DST (one hour of the year doesn't exist and another
     occurs twice). To not risk any conversion errors, keep times as
     `SysTime`s. Aside from DST though, there shouldn't be any conversion
     problems.
-
+)
+$(PANEL
     For using time zones other than local time or UTC, use
     $(REF PosixTimeZone,std,datetime,timezone) on Posix systems (or on Windows,
     if providing the TZ Database files), and use
@@ -499,16 +506,20 @@  private:
     `SysTime` is kept internally in hnsecs from midnight, January 1st, 1 A.D.
     UTC. Conversion error cannot happen when changing the time zone of a
     `SysTime`. $(REF LocalTime,std,datetime,timezone) is the
-    $(REF TimeZone,std,datetime,timezone) class which represents the local time,
-    and `UTC` is the $(REF TimeZone,std,datetime,timezone) class which
-    represents UTC. `SysTime` uses $(REF LocalTime,std,datetime,timezone) if
-    no $(REF TimeZone,std,datetime,timezone) is provided. For more details on
-    time zones, see the documentation for $(REF TimeZone,std,datetime,timezone),
-    $(REF PosixTimeZone,std,datetime,timezone), and
-    $(REF WindowsTimeZone,std,datetime,timezone).
-
+    $(REF_SHORT TimeZone,std,datetime,timezone) class which represents the local time,
+    and `UTC` is the $(REF_SHORT TimeZone,std,datetime,timezone) class which
+    represents UTC. `SysTime` uses $(REF_SHORT LocalTime,std,datetime,timezone) if
+    no $(REF_SHORT TimeZone,std,datetime,timezone) is provided. For more details on
+    time zones, see the documentation for $(REF_SHORT TimeZone,std,datetime,timezone),
+    $(REF_SHORT PosixTimeZone,std,datetime,timezone), and
+    $(REF_SHORT WindowsTimeZone,std,datetime,timezone).
+)
+$(P
     `SysTime`'s range is from approximately 29,000 B.C. to approximately
     29,000 A.D.
+)
+See_Also:
+    $(RELATIVE_LINK2 .Clock.currTime, `Clock.currTime`) will return the current time as a `SysTime`.
   +/
 struct SysTime
 {
@@ -9674,16 +9685,25 @@  private:
 @safe unittest
 {
     import core.time : days, hours, seconds;
-    import std.datetime.date : DateTime;
+    import std.datetime.date : Date, DateTime;
     import std.datetime.timezone : SimpleTimeZone, UTC;
 
+    const dt = DateTime(2018, 1, 1, 10, 30, 0);
     // make a specific point in time in the UTC timezone
-    auto st = SysTime(DateTime(2018, 1, 1, 10, 30, 0), UTC());
+    auto st = SysTime(dt, UTC());
+    assert(st.year == 2018);
+    assert(st.hour == 10);
+
+    // cast to convert
+    assert(cast(DateTime) st == dt);
+    assert(cast(Date) st == Date(2018, 1, 1));
+
     // make a specific point in time in the New York timezone
-    auto ny = SysTime(
-        DateTime(2018, 1, 1, 10, 30, 0),
+    const ny = SysTime(dt,
         new immutable SimpleTimeZone(-5.hours, "America/New_York")
     );
+    assert(ny != st);
+    assert(ny.hour == 10);
 
     // ISO standard time strings
     assert(st.toISOString() == "20180101T103000Z");
@@ -9775,7 +9795,7 @@  long unixTimeToStdTime(long unixTime) @safe pure nothrow @nogc
 
     "std time"'s epoch is based on the Proleptic Gregorian Calendar per ISO
     8601 and is what $(LREF SysTime) uses internally. However, holding the time
-    as an integer in hnescs since that epoch technically isn't actually part of
+    as an integer in hnsecs since that epoch technically isn't actually part of
     the standard, much as it's based on it, so the name "std time" isn't
     particularly good, but there isn't an official name for it. C# uses "ticks"
     for the same thing, but they aren't actually clock ticks, and the term
diff --git a/libphobos/src/std/math/algebraic.d b/libphobos/src/std/math/algebraic.d
index 4791766ab3a..99990716460 100644
--- a/libphobos/src/std/math/algebraic.d
+++ b/libphobos/src/std/math/algebraic.d
@@ -43,24 +43,24 @@  import std.traits : CommonType, isFloatingPoint, isIntegral, isSigned, Unqual;
  *     the return type will be the same as the input.
  *
  * Limitations:
- *     Does not work correctly for signed intergal types and value `Num`.min.
+ *     When x is a signed integral equal to `Num.min` the value of x will be returned instead.
+ *     Note for 2's complement; `-Num.min` (= `Num.max + 1`) is not representable due to overflow.
  */
-auto abs(Num)(Num x) @nogc pure nothrow
-if ((is(immutable Num == immutable short) || is(immutable Num == immutable byte)) ||
-    (is(typeof(Num.init >= 0)) && is(typeof(-Num.init))))
+auto abs(Num)(Num x) @nogc nothrow pure
+if (isIntegral!Num || (is(typeof(Num.init >= 0)) && is(typeof(-Num.init))))
 {
     static if (isFloatingPoint!(Num))
         return fabs(x);
     else
     {
-        static if (is(immutable Num == immutable short) || is(immutable Num == immutable byte))
-            return x >= 0 ? x : cast(Num) -int(x);
+        static if (isIntegral!Num)
+            return x >= 0 ? x : cast(Num) -x;
         else
             return x >= 0 ? x : -x;
     }
 }
 
-/// ditto
+///
 @safe pure nothrow @nogc unittest
 {
     import std.math.traits : isIdentical, isNaN;
@@ -70,16 +70,27 @@  if ((is(immutable Num == immutable short) || is(immutable Num == immutable byte)
     assert(abs(-real.infinity) == real.infinity);
     assert(abs(-56) == 56);
     assert(abs(2321312L)  == 2321312L);
+    assert(abs(23u) == 23u);
 }
 
 @safe pure nothrow @nogc unittest
 {
-    short s = -8;
-    byte b = -8;
-    assert(abs(s) == 8);
-    assert(abs(b) == 8);
-    immutable(byte) c = -8;
-    assert(abs(c) == 8);
+    assert(abs(byte(-8)) == 8);
+    assert(abs(ubyte(8u)) == 8);
+    assert(abs(short(-8)) == 8);
+    assert(abs(ushort(8u)) == 8);
+    assert(abs(int(-8)) == 8);
+    assert(abs(uint(8u)) == 8);
+    assert(abs(long(-8)) == 8);
+    assert(abs(ulong(8u)) == 8);
+    assert(is(typeof(abs(byte(-8))) == byte));
+    assert(is(typeof(abs(ubyte(8u))) == ubyte));
+    assert(is(typeof(abs(short(-8))) == short));
+    assert(is(typeof(abs(ushort(8u))) == ushort));
+    assert(is(typeof(abs(int(-8))) == int));
+    assert(is(typeof(abs(uint(8u))) == uint));
+    assert(is(typeof(abs(long(-8))) == long));
+    assert(is(typeof(abs(ulong(8u))) == ulong));
 }
 
 @safe pure nothrow @nogc unittest
diff --git a/libphobos/src/std/net/curl.d b/libphobos/src/std/net/curl.d
index 2fcbf943122..6aec366c657 100644
--- a/libphobos/src/std/net/curl.d
+++ b/libphobos/src/std/net/curl.d
@@ -2419,8 +2419,8 @@  struct HTTP
         @system @property void onReceiveHeader(void delegate(in char[] key,
                                                      in char[] value) callback)
         {
-            import std.algorithm.searching : startsWith;
-            import std.regex : regex, match;
+            import std.algorithm.searching : findSplit, startsWith;
+            import std.string : indexOf, chomp;
             import std.uni : toLower;
 
             // Wrap incoming callback in order to separate http status line from
@@ -2447,21 +2447,18 @@  struct HTTP
                         return;
                     }
 
-                    // Normal http header
-                    auto m = match(cast(char[]) header, regex("(.*?): (.*)$"));
-
-                    auto fieldName = m.captures[1].toLower().idup;
+                    auto m = header.findSplit(": ");
+                    auto fieldName = m[0].toLower();
+                    auto fieldContent = m[2].chomp;
                     if (fieldName == "content-type")
                     {
-                        auto mct = match(cast(char[]) m.captures[2],
-                                         regex("charset=([^;]*)", "i"));
-                        if (!mct.empty && mct.captures.length > 1)
-                            charset = mct.captures[1].idup;
+                        auto io = indexOf(fieldContent, "charset=", No.caseSensitive);
+                        if (io != -1)
+                            charset = fieldContent[io + "charset=".length .. $].findSplit(";")[0].idup;
                     }
-
-                    if (!m.empty && callback !is null)
-                        callback(fieldName, m.captures[2]);
-                    headersIn[fieldName] = m.captures[2].idup;
+                    if (!m[1].empty && callback !is null)
+                        callback(fieldName, fieldContent);
+                    headersIn[fieldName] = fieldContent.idup;
                 }
                 catch (UTFException e)
                 {
@@ -2479,20 +2476,27 @@  struct HTTP
     /// Parse status line, as received from / generated by cURL.
     private static bool parseStatusLine(const char[] header, out StatusLine status) @safe
     {
-        import std.conv : to;
-        import std.regex : regex, match;
+        import std.algorithm.searching : findSplit, startsWith;
+        import std.conv : to, ConvException;
 
-        const m = match(header, regex(r"^HTTP/(\d+)(?:\.(\d+))? (\d+)(?: (.*))?$"));
-        if (m.empty)
-            return false; // Invalid status line
-        else
+        if (!header.startsWith("HTTP/"))
+            return false;
+
+        try
         {
-            status.majorVersion = to!ushort(m.captures[1]);
-            status.minorVersion = m.captures[2].length ? to!ushort(m.captures[2]) : 0;
-            status.code = to!ushort(m.captures[3]);
-            status.reason = m.captures[4].idup;
+            const m = header["HTTP/".length .. $].findSplit(" ");
+            const v = m[0].findSplit(".");
+            status.majorVersion = to!ushort(v[0]);
+            status.minorVersion = v[1].length ? to!ushort(v[2]) : 0;
+            const s2 = m[2].findSplit(" ");
+            status.code = to!ushort(s2[0]);
+            status.reason = s2[2].idup;
             return true;
         }
+        catch (ConvException e)
+        {
+            return false;
+        }
     }
 
     @safe unittest
@@ -2505,6 +2509,12 @@  struct HTTP
         // The HTTP2 protocol is binary; cURL generates this fake text header.
         assert(parseStatusLine("HTTP/2 200", status)
             && status == StatusLine(2, 0, 200, null));
+
+        assert(!parseStatusLine("HTTP/2", status));
+        assert(!parseStatusLine("HTTP/2 -1", status));
+        assert(!parseStatusLine("HTTP/2  200", status));
+        assert(!parseStatusLine("HTTP/2.X 200", status));
+        assert(!parseStatusLine("HTTP|2 200", status));
     }
 
     /** Time condition enumeration as an alias of $(REF CurlTimeCond, etc,c,curl)