]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
d: Merge upstream dmd, druntime 53a1cc8d13
authorIain Buclaw <ibuclaw@gdcproject.org>
Fri, 14 Mar 2025 00:36:45 +0000 (01:36 +0100)
committerIain Buclaw <ibuclaw@gdcproject.org>
Sun, 16 Mar 2025 19:49:55 +0000 (20:49 +0100)
D front-end changes:

- Typesafe variadic class parameters have been deprecated.

D runtime changes:

- Added `entry' field to TypeInfo_AssociativeArray.

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 53a1cc8d13.
* d-tree.h (create_typeinfo): Change second parameter to Scope *.
(speculative_type_p): Remove prototype.
* d-frontend.cc (getTypeInfoType): Adjust.
* decl.cc: Include dmd/typinf.h.
(DeclVisitor::visit (TypeInfoDeclaration *)): Update for new front-end
interface.
* typeinfo.cc (create_typeinfo): Likewise.
(class SpeculativeTypeVisitor): Remove class.
(speculative_type_p): Remove function.

libphobos/ChangeLog:

* libdruntime/MERGE: Merge upstream druntime 53a1cc8d13.

gcc/testsuite/ChangeLog:

* gdc.dg/pr100967.d: Adjust error message.

155 files changed:
gcc/d/d-frontend.cc
gcc/d/d-tree.h
gcc/d/decl.cc
gcc/d/dmd/MERGE
gcc/d/dmd/attrib.d
gcc/d/dmd/attrib.h
gcc/d/dmd/common/charactertables.d
gcc/d/dmd/cparse.d
gcc/d/dmd/cxxfrontend.d
gcc/d/dmd/dcast.d
gcc/d/dmd/declaration.d
gcc/d/dmd/declaration.h
gcc/d/dmd/dinterpret.d
gcc/d/dmd/doc.d
gcc/d/dmd/dsymbol.d
gcc/d/dmd/dsymbol.h
gcc/d/dmd/dsymbolsem.d
gcc/d/dmd/dtemplate.d
gcc/d/dmd/dtoh.d
gcc/d/dmd/expression.d
gcc/d/dmd/expressionsem.d
gcc/d/dmd/file_manager.d
gcc/d/dmd/func.d
gcc/d/dmd/hdrgen.d
gcc/d/dmd/id.d
gcc/d/dmd/identifier.d
gcc/d/dmd/initsem.d
gcc/d/dmd/json.d
gcc/d/dmd/lambdacomp.d
gcc/d/dmd/lexer.d
gcc/d/dmd/location.d
gcc/d/dmd/mtype.d
gcc/d/dmd/mtype.h
gcc/d/dmd/parse.d
gcc/d/dmd/root/string.d
gcc/d/dmd/semantic2.d
gcc/d/dmd/semantic3.d
gcc/d/dmd/sideeffect.d
gcc/d/dmd/statementsem.d
gcc/d/dmd/tokens.d
gcc/d/dmd/typesem.d
gcc/d/dmd/typinf.d
gcc/d/dmd/typinf.h
gcc/d/typeinfo.cc
gcc/testsuite/gdc.dg/pr100967.d
gcc/testsuite/gdc.test/fail_compilation/attributediagnostic.d
gcc/testsuite/gdc.test/fail_compilation/attributediagnostic_nogc.d
gcc/testsuite/gdc.test/fail_compilation/attributediagnostic_nothrow.d
gcc/testsuite/gdc.test/fail_compilation/b19523.d
gcc/testsuite/gdc.test/fail_compilation/bug9631.d
gcc/testsuite/gdc.test/fail_compilation/code_global_scope.d [new file with mode: 0644]
gcc/testsuite/gdc.test/fail_compilation/constraints_defs.d
gcc/testsuite/gdc.test/fail_compilation/constraints_tmpl.d
gcc/testsuite/gdc.test/fail_compilation/cppmangle.d
gcc/testsuite/gdc.test/fail_compilation/cppvar.d
gcc/testsuite/gdc.test/fail_compilation/diag12829.d
gcc/testsuite/gdc.test/fail_compilation/diag14145.d
gcc/testsuite/gdc.test/fail_compilation/diag20888.d [new file with mode: 0644]
gcc/testsuite/gdc.test/fail_compilation/diag_funclit.d
gcc/testsuite/gdc.test/fail_compilation/diag_template_alias.d
gcc/testsuite/gdc.test/fail_compilation/diag_template_this.d
gcc/testsuite/gdc.test/fail_compilation/e15876_1.d
gcc/testsuite/gdc.test/fail_compilation/e15876_2.d
gcc/testsuite/gdc.test/fail_compilation/e15876_3.d
gcc/testsuite/gdc.test/fail_compilation/e15876_4.d
gcc/testsuite/gdc.test/fail_compilation/e15876_5.d
gcc/testsuite/gdc.test/fail_compilation/fail100.d
gcc/testsuite/gdc.test/fail_compilation/fail11125.d
gcc/testsuite/gdc.test/fail_compilation/fail11375.d
gcc/testsuite/gdc.test/fail_compilation/fail117.d
gcc/testsuite/gdc.test/fail_compilation/fail11751.d
gcc/testsuite/gdc.test/fail_compilation/fail13120.d
gcc/testsuite/gdc.test/fail_compilation/fail13424.d
gcc/testsuite/gdc.test/fail_compilation/fail13498.d
gcc/testsuite/gdc.test/fail_compilation/fail16.d
gcc/testsuite/gdc.test/fail_compilation/fail16575.d
gcc/testsuite/gdc.test/fail_compilation/fail16689.d
gcc/testsuite/gdc.test/fail_compilation/fail16772.d
gcc/testsuite/gdc.test/fail_compilation/fail17570.d
gcc/testsuite/gdc.test/fail_compilation/fail18970.d
gcc/testsuite/gdc.test/fail_compilation/fail19759.d
gcc/testsuite/gdc.test/fail_compilation/fail20073.d
gcc/testsuite/gdc.test/fail_compilation/fail20376.d
gcc/testsuite/gdc.test/fail_compilation/fail21206.d
gcc/testsuite/gdc.test/fail_compilation/fail22.d
gcc/testsuite/gdc.test/fail_compilation/fail22054.d
gcc/testsuite/gdc.test/fail_compilation/fail2450.d
gcc/testsuite/gdc.test/fail_compilation/fail3673b.d
gcc/testsuite/gdc.test/fail_compilation/fail4269e.d
gcc/testsuite/gdc.test/fail_compilation/fail4544.d
gcc/testsuite/gdc.test/fail_compilation/fail6334.d
gcc/testsuite/gdc.test/fail_compilation/fail99.d
gcc/testsuite/gdc.test/fail_compilation/failcontracts.d
gcc/testsuite/gdc.test/fail_compilation/fnconstraint.d
gcc/testsuite/gdc.test/fail_compilation/ice10922.d
gcc/testsuite/gdc.test/fail_compilation/ice10938.d
gcc/testsuite/gdc.test/fail_compilation/ice11153.d
gcc/testsuite/gdc.test/fail_compilation/ice11963.d
gcc/testsuite/gdc.test/fail_compilation/ice11965.d
gcc/testsuite/gdc.test/fail_compilation/ice15855.d
gcc/testsuite/gdc.test/fail_compilation/ice22377.d
gcc/testsuite/gdc.test/fail_compilation/ice8309.d
gcc/testsuite/gdc.test/fail_compilation/ice9406.d
gcc/testsuite/gdc.test/fail_compilation/issue16020.d
gcc/testsuite/gdc.test/fail_compilation/misc1.d
gcc/testsuite/gdc.test/fail_compilation/nogc3.d
gcc/testsuite/gdc.test/fail_compilation/noreturn2.d
gcc/testsuite/gdc.test/fail_compilation/opapplyscope.d
gcc/testsuite/gdc.test/fail_compilation/parse14285.d
gcc/testsuite/gdc.test/fail_compilation/previewin.d
gcc/testsuite/gdc.test/fail_compilation/retscope.d
gcc/testsuite/gdc.test/fail_compilation/retscope2.d
gcc/testsuite/gdc.test/fail_compilation/retscope3.d
gcc/testsuite/gdc.test/fail_compilation/shared.d
gcc/testsuite/gdc.test/fail_compilation/systemvariables_deprecation.d
gcc/testsuite/gdc.test/fail_compilation/template_decl.d
gcc/testsuite/gdc.test/fail_compilation/test1.d
gcc/testsuite/gdc.test/fail_compilation/test14238.d
gcc/testsuite/gdc.test/fail_compilation/test14538.d
gcc/testsuite/gdc.test/fail_compilation/test16188.d
gcc/testsuite/gdc.test/fail_compilation/test16193.d
gcc/testsuite/gdc.test/fail_compilation/test19107.d
gcc/testsuite/gdc.test/fail_compilation/test19971.d
gcc/testsuite/gdc.test/fail_compilation/test21062.d
gcc/testsuite/gdc.test/fail_compilation/test21096.d
gcc/testsuite/gdc.test/fail_compilation/test21912.d
gcc/testsuite/gdc.test/fail_compilation/test22023.d
gcc/testsuite/gdc.test/fail_compilation/test22818.d
gcc/testsuite/gdc.test/fail_compilation/test23112.d
gcc/testsuite/gdc.test/fail_compilation/test23873.d
gcc/testsuite/gdc.test/fail_compilation/testInference.d
gcc/testsuite/gdc.test/fail_compilation/testsemi.d
gcc/testsuite/gdc.test/fail_compilation/traits_alone.d
gcc/testsuite/gdc.test/fail_compilation/udaparams.d
gcc/testsuite/gdc.test/fail_compilation/var_func_attr.d
gcc/testsuite/gdc.test/runnable/testaa2.d
gcc/testsuite/gdc.test/runnable/testv.d
libphobos/libdruntime/MERGE
libphobos/libdruntime/core/internal/array/appending.d
libphobos/libdruntime/core/internal/array/concatenation.d
libphobos/libdruntime/core/internal/array/construction.d
libphobos/libdruntime/core/internal/array/utils.d
libphobos/libdruntime/core/internal/newaa.d
libphobos/libdruntime/core/lifetime.d
libphobos/libdruntime/core/stdc/config.d
libphobos/libdruntime/core/stdc/math.d
libphobos/libdruntime/core/stdc/stdio.d
libphobos/libdruntime/core/stdc/stdlib.d
libphobos/libdruntime/core/sys/windows/sql.d
libphobos/libdruntime/core/sys/windows/sqlext.d
libphobos/libdruntime/core/sys/windows/sqltypes.d
libphobos/libdruntime/core/sys/windows/sqlucode.d
libphobos/libdruntime/object.d
libphobos/libdruntime/rt/aaA.d
libphobos/libdruntime/rt/lifetime.d

index 0927a3d21c4a31321cd4157934742dd913ca245b..3778cc6e593534db8b54ec5af7b0e13244d02bf0 100644 (file)
@@ -83,7 +83,7 @@ getTypeInfoType (Loc loc, Type *type, Scope *sc)
 {
   gcc_assert (type->ty != TY::Terror);
   check_typeinfo_type (loc, sc);
-  create_typeinfo (type, sc ? sc->_module->importedFrom : NULL);
+  create_typeinfo (type, sc);
   return type->vtinfo->type;
 }
 
index b3e84d1baef88549abf5c2459c9074a21c81c3ba..42d01e45595065eba2cff8f92aeaa0ab00100182 100644 (file)
@@ -704,11 +704,10 @@ extern tree get_classinfo_decl (ClassDeclaration *);
 extern void check_typeinfo_type (const Loc &, Scope *, Expression * = NULL);
 extern tree build_typeinfo (const Loc &, Type *, Expression * = NULL);
 extern tree build_typeinfo (Expression *, Type *);
-extern void create_typeinfo (Type *, Module *);
+extern void create_typeinfo (Type *, Scope *);
 extern void create_tinfo_types (Module *);
 extern void layout_cpp_typeinfo (ClassDeclaration *);
 extern tree get_cpp_typeinfo_decl (ClassDeclaration *);
-extern bool speculative_type_p (Type *);
 
 /* In toir.cc.  */
 extern void push_binding_level (level_kind);
index 913a9b37690322d1c4ef4ac54cbf717003fa9499..c05c30397b8ab2cb12ca60cfca93573f9c48827b 100644 (file)
@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "dmd/nspace.h"
 #include "dmd/target.h"
 #include "dmd/template.h"
+#include "dmd/typinf.h"
 
 #include "tree.h"
 #include "tree-iterator.h"
@@ -899,7 +900,7 @@ public:
     if (d->semanticRun >= PASS::obj)
       return;
 
-    if (speculative_type_p (d->tinfo))
+    if (dmd::isSpeculativeType (d->tinfo))
       return;
 
     tree t = get_typeinfo_decl (d);
index 59d5a18481001abde457b91b2c4abd9ab5b183fd..66cfdd6ad4ac977922fed28fbfeadd5e7800ced0 100644 (file)
@@ -1,4 +1,4 @@
-ffbad272b649b7ae3e88cfdc85688bfef3168994
+53a1cc8d13e8db2cb1642219320a8dfc1b0cc6c5
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/dmd repository.
index f5618f1373316bb2b3f695b694d2bb7a2eeccb37..df04ed1756de1ed8da37f3e602724966e2bd89c5 100644 (file)
@@ -32,7 +32,7 @@ import dmd.declaration;
 import dmd.dmodule;
 import dmd.dscope;
 import dmd.dsymbol;
-import dmd.dsymbolsem : setScope, addMember, include;
+import dmd.dsymbolsem : include;
 import dmd.expression;
 import dmd.func;
 import dmd.globals;
@@ -125,11 +125,6 @@ extern (C++) abstract class AttribDeclaration : Dsymbol
         return this.include(null).foreachDsymbol( (s) { return s.hasStaticCtorOrDtor(); } ) != 0;
     }
 
-    override final void checkCtorConstInit()
-    {
-        this.include(null).foreachDsymbol( s => s.checkCtorConstInit() );
-    }
-
     /****************************************
      */
     override final void addObjcSymbols(ClassDeclarations* classes, ClassDeclarations* categories)
index 79b0cb02c1e9338d5d3dca950ea44c72c540d31b..ab5f219db88d50749203a34a4539b8a818ed1cfc 100644 (file)
@@ -32,7 +32,6 @@ public:
     bool oneMember(Dsymbol *&ps, Identifier *ident) override;
     bool hasPointers() override final;
     bool hasStaticCtorOrDtor() override final;
-    void checkCtorConstInit() override final;
     AttribDeclaration *isAttribDeclaration() override { return this; }
 
     void accept(Visitor *v) override { v->visit(this); }
index ac89807ddea0b4d5bca29b016a84e240db75a562..6a3b302c1ebc778bf1d95acc9df9acb3c1cecea1 100644 (file)
@@ -42,7 +42,8 @@ struct IdentifierCharLookup
         // Awful solution to require these lambdas.
         // However without them the extern(C++) ABI issues crop up for isInRange,
         //  and then it can't access the tables.
-        final switch(table) {
+        final switch(table)
+        {
             case IdentifierTable.UAX31:
                 return IdentifierCharLookup(
                         (c) => isInRange!UAX31_Start(c),
index 548bee992e151b08a5531c72f2b02732e09f957a..9f1eab7fc6c9c2eb9f46d8ad7b6a94d0cadbe481 100644 (file)
@@ -2006,7 +2006,7 @@ final class CParser(AST) : Parser!AST
                     //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
+                        ad.hidden = true; // do not print when generating .di files
                     s = ad;
                 }
 
@@ -2088,8 +2088,7 @@ final class CParser(AST) : Parser!AST
                     {
                         auto str = asmName.peekString();
                         p.mangleOverride = str;
-//                      p.adFlags |= AST.VarDeclaration.nounderscore;
-                        p.adFlags |= 4; // cannot get above line to compile on Ubuntu
+                        p.noUnderscore = true;
                     }
                 }
                 s = applySpecifier(s, specifier);
@@ -5527,6 +5526,12 @@ final class CParser(AST) : Parser!AST
             if (pt && *pt)
                 t = *pt;
         }
+        if (t.mcache && t.mcache.typedefIdent)
+        {
+            t = t.copy();
+            t.mcache = null;
+        }
+        t.getMcache().typedefIdent = id;
         auto tab = cast(void*[void*])(typedefTab[$ - 1]);
         tab[cast(void*)id] = cast(void*)t;
         typedefTab[$ - 1] = cast(void*)tab;
index dfc76ff95250e0d144b0fb22d093c9bc43c03907..3cd4ced6b4915169492896e8f1b79d89785e83ec 100644 (file)
@@ -15,6 +15,7 @@ import dmd.arraytypes;
 import dmd.astenums;
 import dmd.attrib;
 import dmd.common.outbuffer : OutBuffer;
+import dmd.declaration : TypeInfoDeclaration;
 import dmd.denum : EnumDeclaration;
 import dmd.dmodule /*: Module*/;
 import dmd.dscope : Scope;
@@ -702,6 +703,18 @@ bool builtinTypeInfo(Type t)
     return dmd.typinf.builtinTypeInfo(t);
 }
 
+Type makeNakedAssociativeArray(TypeAArray t)
+{
+    import dmd.typinf;
+    return dmd.typinf.makeNakedAssociativeArray(t);
+}
+
+TypeInfoDeclaration getTypeInfoAssocArrayDeclaration(TypeAArray t, Scope* sc)
+{
+    import dmd.typinf;
+    return dmd.typinf.getTypeInfoAssocArrayDeclaration(t, sc);
+}
+
 version (IN_LLVM)
 {
     /***********************************************************
index f42a061517c7bf56002abe2b30c0b60b57bb2d34..172c8278f7fde76b0454d2ecb5907668b59bd2b6 100644 (file)
@@ -150,7 +150,7 @@ Expression implicitCastTo(Expression e, Scope* sc, Type t)
                 //printf("type %s t %s\n", type.deco, t.deco);
                 auto ts = toAutoQualChars(e.type, t);
                 error(e.loc, "cannot implicitly convert expression `%s` of type `%s` to `%s`",
-                    e.toChars(), ts[0], ts[1]);
+                    e.toErrMsg(), ts[0], ts[1]);
             }
         }
         return ErrorExp.get();
@@ -2832,6 +2832,7 @@ Expression castTo(Expression e, Scope* sc, Type t, Type att = null)
                 (*ae.keys)[i] = ex;
             }
             ae.type = t;
+            semanticTypeInfo(sc, ae.type);
             return ae;
         }
         return visit(e);
index 26887f897ed0bde50d58b2623f6c7072d232fc60..30f017d8952585e182fc8964b50ff0aaab5de88d 100644 (file)
@@ -54,6 +54,7 @@ else version = MARS;
  */
 void ObjectNotFound(Loc loc, Identifier id)
 {
+    global.gag = 0; // never gag the fatal error
     error(loc, "`%s` not found. object.d may be incorrectly installed or corrupt.", id.toChars());
     version (IN_LLVM)
     {
@@ -87,19 +88,23 @@ extern (C++) abstract class Declaration : Dsymbol
     Type type;
     Type originalType;  // before semantic analysis
     StorageClass storage_class = STC.undefined_;
+    // overridden symbol with pragma(mangle, "...")
+    const(char)[] mangleOverride;
     Visibility visibility;
-    LINK _linkage = LINK.default_; // may be `LINK.system`; use `resolvedLinkage()` to resolve it
     short inuse;          // used to detect cycles
 
-    ubyte adFlags;         // control re-assignment of AliasDeclaration (put here for packing reasons)
-      enum wasRead    = 1; // set if AliasDeclaration was read
-      enum ignoreRead = 2; // ignore any reads of AliasDeclaration
-      enum nounderscore = 4; // don't prepend _ to mangled name
-      enum hidden       = 8; // don't print this in .di files
-      enum nrvo = 0x10;      /// forward to fd.nrvo_var when generating code
+    private extern (D) static struct BitFields
+    {
+        LINK _linkage = LINK.default_; // may be `LINK.system`; use `resolvedLinkage()` to resolve it
+        bool wasRead;      // set if AliasDeclaration was read
+        bool ignoreRead;   // ignore any reads of AliasDeclaration
+        bool noUnderscore; // don't prepend _ to mangled name
+        bool hidden;       // don't print this in .di files
+        bool nrvo;         /// forward to fd.nrvo_var when generating code
+    }
 
-    // overridden symbol with pragma(mangle, "...")
-    const(char)[] mangleOverride;
+    import dmd.common.bitfields;
+    mixin(generateBitFields!(BitFields, ubyte));
 
     final extern (D) this(Identifier ident) @safe
     {
@@ -628,8 +633,8 @@ extern (C++) final class AliasDeclaration : Declaration
             return aliassym;
         }
         // Reading the AliasDeclaration
-        if (!(adFlags & ignoreRead))
-            adFlags |= wasRead;                 // can never assign to this AliasDeclaration again
+        if (!this.ignoreRead)
+            this.wasRead = true;                 // can never assign to this AliasDeclaration again
 
         if (inuse == 1 && type && _scope)
         {
@@ -1124,16 +1129,6 @@ extern (C++) class VarDeclaration : Declaration
         return e;
     }
 
-    override final void checkCtorConstInit()
-    {
-        version (none)
-        {
-            /* doesn't work if more than one static ctor */
-            if (ctorinit == 0 && isCtorinit() && !isField())
-                error("missing initializer in static constructor for const variable");
-        }
-    }
-
     /************************************
      * Check to see if this variable is actually in an enclosing function
      * rather than the current one.
@@ -1544,6 +1539,8 @@ extern (C++) final class TypeInfoStaticArrayDeclaration : TypeInfoDeclaration
  */
 extern (C++) final class TypeInfoAssociativeArrayDeclaration : TypeInfoDeclaration
 {
+    Type entry; // type of TypeInfo_AssociativeArray.Entry!(t.index, t.next)
+
     extern (D) this(Type tinfo)
     {
         super(tinfo);
index 4fd35ee76c8e8dbb2a21e87a82cd515cd1fc3267..6fef6a5b3a4074b4ab0f92252de40a58ceaa590b 100644 (file)
@@ -121,11 +121,10 @@ public:
     Type *type;
     Type *originalType;         // before semantic analysis
     StorageClass storage_class;
+    DString mangleOverride;     // overridden symbol with pragma(mangle, "...")
     Visibility visibility;
-    LINK _linkage;              // may be `LINK::system`; use `resolvedLinkage()` to resolve it
     short inuse;                // used to detect cycles
-    uint8_t adFlags;
-    DString mangleOverride;     // overridden symbol with pragma(mangle, "...")
+    uint8_t bitFields;
 
     const char *kind() const override;
     uinteger_t size(Loc loc) override final;
@@ -299,7 +298,6 @@ public:
     bool hasPointers() override final;
     bool canTakeAddressOf();
     bool needsScopeDtor();
-    void checkCtorConstInit() override final;
     Dsymbol *toAlias() override final;
     // Eliminate need for dynamic_cast
     VarDeclaration *isVarDeclaration() override final { return (VarDeclaration *)this; }
@@ -398,6 +396,8 @@ public:
 class TypeInfoAssociativeArrayDeclaration final : public TypeInfoDeclaration
 {
 public:
+    Type* entry;
+
     static TypeInfoAssociativeArrayDeclaration *create(Type *tinfo);
 
     void accept(Visitor *v) override { v->visit(this); }
index 5dbab0918c0d59dd4fe110c0111169575c4f85e3..3a08c10daf57a82510f2586dfcad70a183192054 100644 (file)
@@ -1989,13 +1989,15 @@ public:
             Declaration decl = ve.var;
 
             // We cannot take the address of an imported symbol at compile time
-            if (decl.isImportedSymbol()) {
+            if (decl.isImportedSymbol())
+            {
                 error(e.loc, "cannot take address of imported symbol `%s` at compile time", decl.toChars());
                 result = CTFEExp.cantexp;
                 return;
             }
 
-            if (decl.isDataseg()) {
+            if (decl.isDataseg())
+            {
                 // Normally this is already done by optimize()
                 // Do it here in case optimize(WANTvalue) wasn't run before CTFE
                 emplaceExp!(SymOffExp)(pue, e.loc, e.e1.isVarExp().var, 0);
index 0e77cdfc982a59100b487e50146432a00bb6ca02..261fa387e0acb1989ea020e08b4de1982f0c5392 100644 (file)
@@ -2061,9 +2061,9 @@ string toLowercase(string s) pure @safe
 // TODO: maybe unicode lowercase, somehow
         if (c >= 'A' && c <= 'Z')
         {
-            if (!lower.length) {
+            if (!lower.length)
                 lower.reserve(s.length);
-            }
+
             lower ~= s[lower.length..i];
             c += 'a' - 'A';
             lower ~= c;
index bad9ca2080fe62873e3636961013280b529c6756..64cf6be84ee34d81f8dcb5cebf7ceeec39c2b859 100644 (file)
@@ -916,10 +916,6 @@ extern (C++) class Dsymbol : ASTNode
     {
     }
 
-    void checkCtorConstInit()
-    {
-    }
-
     /****************************************
      * Add documentation comment to Dsymbol.
      * Ignore NULL comments.
index 6d223bf1e6821e16251ea654e2d598abddde7ce7..8209dea02ee0b02014cd371972192f39e6b68606 100644 (file)
@@ -241,7 +241,6 @@ public:
     virtual bool hasPointers();
     virtual bool hasStaticCtorOrDtor();
     virtual void addObjcSymbols(ClassDeclarations *, ClassDeclarations *) { }
-    virtual void checkCtorConstInit() { }
 
     virtual void addComment(const utf8_t *comment);
     const utf8_t *comment();                      // current value of comment
index 3e7f9b92671a455678ee7dc53f35f770e4ee0096..b01736677cb85338905c11cac401b68fc2991dd6 100644 (file)
@@ -1896,8 +1896,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
             const sident = se.toStringz();
             if (!sident.length || !Identifier.isValidIdentifier(sident))
             {
-                error(ns.exp.loc, "expected valid identifier for C++ namespace but got `%.*s`",
-                             cast(int)sident.length, sident.ptr);
+                error(ns.exp.loc, "expected valid identifier for C++ namespace but got `%s`", se.toErrMsg());
                 return null;
             }
             else
@@ -5343,7 +5342,8 @@ void aliasSemantic(AliasDeclaration ds, Scope* sc)
             {
                 s = tident.toDsymbol(sc);
                 // don't error for `var1.static_symbol`
-                if (s && s.needThis()) {
+                if (s && s.needThis())
+                {
                     error(ds.loc, "cannot alias %s member `%s` of variable `%s`",
                         s.kind(), s.toChars(), mt.ident.toChars());
                     errorSupplemental(ds.loc, "Use `typeof(%s)` instead to preserve behaviour",
@@ -5500,7 +5500,7 @@ private void aliasAssignSemantic(AliasAssign ds, Scope* sc)
     if (!aliassym)
         return errorRet();
 
-    if (aliassym.adFlags & Declaration.wasRead)
+    if (aliassym.wasRead)
     {
         if (!aliassym.errors)
             error(ds.loc, "%s was read, so cannot reassign", aliassym.toChars());
@@ -5508,7 +5508,7 @@ private void aliasAssignSemantic(AliasAssign ds, Scope* sc)
         return errorRet();
     }
 
-    aliassym.adFlags |= Declaration.ignoreRead; // temporarilly allow reads of aliassym
+    aliassym.ignoreRead = true; // temporarilly allow reads of aliassym
 
     const storage_class = sc.stc & (STC.deprecated_ | STC.ref_ | STC.nothrow_ | STC.nogc | STC.pure_ | STC.shared_ | STC.disable);
 
@@ -5632,8 +5632,7 @@ private void aliasAssignSemantic(AliasAssign ds, Scope* sc)
         aliassym.aliassym = null;
     }
 
-
-    aliassym.adFlags &= ~Declaration.ignoreRead;
+    aliassym.ignoreRead = false;
 
     if (aliassym.type && aliassym.type.ty == Terror ||
         global.gag && errors != global.errors)
@@ -7940,3 +7939,31 @@ extern (C++) class AddCommentVisitor: Visitor
     }
     override void visit(StaticForeachDeclaration sfd) {}
 }
+
+void checkCtorConstInit(Dsymbol d)
+{
+    scope v = new CheckCtorConstInitVisitor();
+    d.accept(v);
+}
+
+private extern(C++) class CheckCtorConstInitVisitor : Visitor
+{
+    alias visit = Visitor.visit;
+
+    override void visit(AttribDeclaration ad)
+    {
+        ad.include(null).foreachDsymbol( s => s.checkCtorConstInit() );
+    }
+
+    override void visit(VarDeclaration vd)
+    {
+        version (none)
+        {
+            /* doesn't work if more than one static ctor */
+            if (vd.ctorinit == 0 && vd.isCtorinit() && !vd.isField())
+                error("missing initializer in static constructor for const variable");
+        }
+    }
+
+    override void visit(Dsymbol d){}
+}
index 1aab94d7c1f9eb861ee2af7d6dc0084a6dd6c47e..c19d4b942f2e6fedfcc1e7e338aa3ec88a8938bc 100644 (file)
@@ -136,6 +136,13 @@ inout(Parameter) isParameter(inout RootObject o)
     return cast(inout(Parameter))o;
 }
 
+inout(Identifier) isIdentifier(inout RootObject o)
+{
+    if (!o || o.dyncast() != DYNCAST.identifier)
+        return null;
+    return cast(inout(Identifier))o;
+}
+
 inout(TemplateParameter) isTemplateParameter(inout RootObject o)
 {
     if (!o || o.dyncast() != DYNCAST.templateparameter)
@@ -3884,7 +3891,7 @@ extern (C++) class TemplateInstance : ScopeDsymbol
         if (n_instantiations <= max_shown)
         {
             for (TemplateInstance cur = this; cur; cur = cur.tinst)
-                printFn(cur.loc, format, cur.toChars());
+                printFn(cur.loc, format, cur.toErrMsg());
         }
         else if (n_instantiations - n_totalrecursions <= max_shown)
         {
@@ -6265,6 +6272,9 @@ void write(ref OutBuffer buf, RootObject obj)
 {
     if (obj)
     {
-        buf.writestring(obj.toChars());
+        if (auto e = isExpression(obj))
+            buf.writestring(e.toErrMsg());
+        else
+            buf.writestring(obj.toChars());
     }
 }
index efd0a2f53e20e395987bd1f8c009e36c11da651b..a586f87490273e51cef3db2c21bebe12cf97718b 100644 (file)
@@ -976,7 +976,8 @@ public:
         {
             EnumKind kind = getEnumKind(type);
 
-            if (vd.visibility.kind == AST.Visibility.Kind.none || vd.visibility.kind == AST.Visibility.Kind.private_) {
+            if (vd.visibility.kind == AST.Visibility.Kind.none || vd.visibility.kind == AST.Visibility.Kind.private_)
+            {
                 ignored("enum `%s` because it is `%s`.", vd.toPrettyChars(), AST.visibilityToChars(vd.visibility.kind));
                 return;
             }
index 68276127e250008346719fe9d572a60855ec82b1..388023f53c6d2554b1258fbe5d3138b27dc2edfc 100644 (file)
@@ -383,8 +383,7 @@ extern (C++) abstract class Expression : ASTNode
 
     final override const(char)* toChars() const
     {
-        // FIXME: Test suite relies on lambda's being printed as __lambdaXXX in errors and .stringof
-        // Printing a (truncated) lambda body is more user friendly
+        // FIXME: mangling (see runnable/mangle.d) relies on toChars outputting __lambdaXXX here
         if (auto fe = isFuncExp())
             return fe.fd.toChars();
 
index 7a35328b8553919bf8e7e86535f8b0f199713ae7..22fbfc29969b7a9eb7e4d42f3f40b525a9b525e9 100644 (file)
@@ -362,11 +362,11 @@ private Expression incompatibleTypes(UnaExp e)
 
     if (e.e1.op == EXP.type)
     {
-        error(e.loc, "incompatible type for `%s(%s)`: cannot use `%s` with types", EXPtoString(e.op).ptr, e.e1.toChars(), EXPtoString(e.op).ptr);
+        error(e.loc, "incompatible type for `%s(%s)`: cannot use `%s` with types", EXPtoString(e.op).ptr, e.e1.toErrMsg(), EXPtoString(e.op).ptr);
     }
     else
     {
-        error(e.loc, "incompatible type for `%s(%s)`: `%s`", EXPtoString(e.op).ptr, e.e1.toChars(), e.e1.type.toChars());
+        error(e.loc, "incompatible type for `%s(%s)`: `%s`", EXPtoString(e.op).ptr, e.e1.toErrMsg(), e.e1.type.toChars());
     }
     return ErrorExp.get();
 }
@@ -393,18 +393,18 @@ extern (D) Expression incompatibleTypes(BinExp e, Scope* sc = null)
     if (e.e1.op == EXP.type || e.e2.op == EXP.type)
     {
         error(e.loc, "incompatible types for `(%s) %s (%s)`: cannot use `%s` with types",
-            e.e1.toChars(), thisOp, e.e2.toChars(), EXPtoString(e.op).ptr);
+            e.e1.toErrMsg(), thisOp, e.e2.toErrMsg(), EXPtoString(e.op).ptr);
     }
     else if (e.e1.type.equals(e.e2.type))
     {
         error(e.loc, "incompatible types for `(%s) %s (%s)`: both operands are of type `%s`",
-            e.e1.toChars(), thisOp, e.e2.toChars(), e.e1.type.toChars());
+            e.e1.toErrMsg(), thisOp, e.e2.toErrMsg(), e.e1.type.toChars());
     }
     else
     {
         auto ts = toAutoQualChars(e.e1.type, e.e2.type);
         error(e.loc, "incompatible types for `(%s) %s (%s)`: `%s` and `%s`",
-            e.e1.toChars(), thisOp, e.e2.toChars(), ts[0], ts[1]);
+            e.e1.toErrMsg(), thisOp, e.e2.toErrMsg(), ts[0], ts[1]);
     }
     return ErrorExp.get();
 }
@@ -731,7 +731,7 @@ Expression resolveOpDollar(Scope* sc, ArrayExp ae, out Expression pe0)
 
         if (!e.type)
         {
-            error(ae.loc, "`%s` has no value", e.toChars());
+            error(ae.loc, "`%s` has no value", e.toErrMsg());
             e = ErrorExp.get();
         }
         if (e.op == EXP.error)
@@ -768,7 +768,7 @@ Expression resolveOpDollar(Scope* sc, ArrayExp ae, IntervalExp ie, ref Expressio
         e = resolveProperties(sc, e);
         if (!e.type)
         {
-            error(ae.loc, "`%s` has no value", e.toChars());
+            error(ae.loc, "`%s` has no value", e.toErrMsg());
             errors = true;
         }
         return e;
@@ -853,7 +853,7 @@ extern (D) Expression doCopyOrMove(Scope* sc, Expression e, Type t, bool nrvo, b
          */
         VarDeclaration vd = new VarDeclaration(e.loc, e.type, Identifier.generateId("__copyrvalue"), null);
         if (nrvo)
-            vd.adFlags |= Declaration.nrvo;
+            vd.nrvo = true;
         vd.storage_class |= STC.nodtor;
         vd.dsymbolSemantic(sc);
         Expression de = new DeclarationExp(e.loc, vd);
@@ -903,7 +903,7 @@ private Expression callCpCtor(Scope* sc, Expression e, Type destinationType, boo
      */
     VarDeclaration tmp = copyToTemp(STC.rvalue, "__copytmp", e);
     if (nrvo)
-        tmp.adFlags |= Declaration.nrvo;
+        tmp.nrvo = true;
     if (sd.hasCopyCtor && destinationType)
     {
         // https://issues.dlang.org/show_bug.cgi?id=22619
@@ -2109,7 +2109,7 @@ public void errorSupplementalInferredAttr(FuncDeclaration fd, int maxDepth, bool
     {
         if (maxDepth > 0)
         {
-            errorFunc(s.loc, "which calls `%s`", s.fd.toPrettyChars());
+            errorFunc(s.loc, "which calls `%s`", s.fd.toErrMsg());
             errorSupplementalInferredAttr(s.fd, maxDepth - 1, deprecation, stc, eSink);
         }
     }
@@ -2477,7 +2477,7 @@ private Expression resolvePropertiesX(Scope* sc, Expression e1, Expression e2 =
             auto tf = fd.type.isTypeFunction();
             if (!tf.isRef && e2)
             {
-                error(loc, "%s is not an lvalue", e1.toChars());
+                error(loc, "%s is not an lvalue", e1.toErrMsg());
                 return ErrorExp.get();
             }
         }
@@ -2645,13 +2645,13 @@ private Expression resolvePropertiesX(Scope* sc, Expression e1, Expression e2 =
 
     if (!e1.type)
     {
-        error(loc, "cannot resolve type for %s", e1.toChars());
+        error(loc, "cannot resolve type for %s", e1.toErrMsg());
         e1 = ErrorExp.get();
     }
     return e1;
 
 Leprop:
-    error(loc, "not a property %s", e1.toChars());
+    error(loc, "not a property %s", e1.toErrMsg());
     return ErrorExp.get();
 }
 
@@ -2715,7 +2715,7 @@ private Type arrayExpressionToCommonType(Scope* sc, ref Expressions exps)
         e = resolveProperties(sc, e);
         if (!e.type)
         {
-            error(e.loc, "`%s` has no value", e.toChars());
+            error(e.loc, "`%s` has no value", e.toErrMsg());
             t0 = Type.terror;
             continue;
         }
@@ -2912,7 +2912,7 @@ private bool preFunctionParameters(Scope* sc, ArgumentList argumentList, ErrorSi
             {
                 if (eSink)
                 {
-                    eSink.error(arg.loc, "cannot pass type `%s` as a function argument", arg.toChars());
+                    eSink.error(arg.loc, "cannot pass type `%s` as a function argument", arg.toErrMsg());
                     arg = ErrorExp.get();
                 }
                 err = true;
@@ -2922,7 +2922,7 @@ private bool preFunctionParameters(Scope* sc, ArgumentList argumentList, ErrorSi
         {
             if (eSink)
             {
-                eSink.error(arg.loc, "cannot pass function `%s` as a function argument", arg.toChars());
+                eSink.error(arg.loc, "cannot pass function `%s` as a function argument", arg.toErrMsg());
                 arg = ErrorExp.get();
             }
             err = true;
@@ -3515,7 +3515,7 @@ private bool functionParameters(Loc loc, Scope* sc,
             {
                 if (se.hasOverloads && !se.var.isFuncDeclaration().isUnique())
                 {
-                    error(arg.loc, "function `%s` is overloaded", arg.toChars());
+                    error(arg.loc, "function `%s` is overloaded", arg.toErrMsg());
                     err = true;
                 }
             }
@@ -4159,7 +4159,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
             {
                 if (!s)
                 {
-                    error(e.loc, "`%s` is not in a class or struct scope", e.toChars());
+                    error(e.loc, "`%s` is not in a class or struct scope", e.toErrMsg());
                     return setError();
                 }
                 ClassDeclaration cd = s.isClassDeclaration();
@@ -4225,7 +4225,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
             {
                 if (!s)
                 {
-                    error(e.loc, "`%s` is not in a class scope", e.toChars());
+                    error(e.loc, "`%s` is not in a class scope", e.toErrMsg());
                     return setError();
                 }
                 cd = s.isClassDeclaration();
@@ -4489,7 +4489,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
             e = e.expressionSemantic(sc);
             if (!e.type)
             {
-                error(exp.loc, "`%s` has no value", e.toChars());
+                error(exp.loc, "`%s` has no value", e.toErrMsg());
                 err = true;
             }
             else if (e.op == EXP.error)
@@ -4540,7 +4540,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
          */
         if (e.elements.length > 0 && t0.ty == Tvoid)
         {
-            error(e.loc, "`%s` of type `%s` has no value", e.toChars(), e.type.toChars());
+            error(e.loc, "`%s` of type `%s` has no value", e.toErrMsg(), e.type.toChars());
             return setError();
         }
 
@@ -4864,14 +4864,6 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
         id = new DotTemplateInstanceExp(ne.loc, id, hook, tiargs);
 
         auto arguments = new Expressions();
-        if (global.params.tracegc)
-        {
-            auto funcname = (sc.callsc && sc.callsc.func) ?
-                sc.callsc.func.toPrettyChars() : sc.func.toPrettyChars();
-            arguments.push(new StringExp(ne.loc, ne.loc.filename.toDString()));
-            arguments.push(new IntegerExp(ne.loc, ne.loc.linnum, Type.tint32));
-            arguments.push(new StringExp(ne.loc, funcname.toDString()));
-        }
         id = new CallExp(ne.loc, id, arguments);
 
         ne.lowering = id.expressionSemantic(sc);
@@ -5210,14 +5202,6 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                 tiargs.push(t);
                 id = new DotTemplateInstanceExp(exp.loc, id, hook, tiargs);
                 auto arguments = new Expressions();
-                if (global.params.tracegc)
-                {
-                    auto funcname = (sc.callsc && sc.callsc.func) ?
-                        sc.callsc.func.toPrettyChars() : sc.func.toPrettyChars();
-                    arguments.push(new StringExp(exp.loc, exp.loc.filename.toDString()));
-                    arguments.push(new IntegerExp(exp.loc, exp.loc.linnum, Type.tint32));
-                    arguments.push(new StringExp(exp.loc, funcname.toDString()));
-                }
                 id = new CallExp(exp.loc, id, arguments);
 
                 exp.lowering = id.expressionSemantic(sc);
@@ -5359,9 +5343,9 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
             if (!global.params.useGC && sc.needsCodegen())
             {
                 version(IN_GCC)
-                    error(exp.loc, "expression `%s` allocates with the GC and cannot be used with switch `-fno-rtti`", exp.toChars());
+                    error(exp.loc, "expression `%s` allocates with the GC and cannot be used with switch `-fno-rtti`", exp.toErrMsg());
                 else
-                    error(exp.loc, "expression `%s` allocates with the GC and cannot be used with switch `-betterC`", exp.toChars());
+                    error(exp.loc, "expression `%s` allocates with the GC and cannot be used with switch `-betterC`", exp.toErrMsg());
                 return setError();
             }
 
@@ -5402,14 +5386,6 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                 lowering = new DotTemplateInstanceExp(exp.loc, lowering, hook, tiargs);
 
                 auto arguments = new Expressions();
-                if (global.params.tracegc)
-                {
-                    auto funcname = (sc.callsc && sc.callsc.func) ?
-                        sc.callsc.func.toPrettyChars() : sc.func.toPrettyChars();
-                    arguments.push(new StringExp(exp.loc, exp.loc.filename.toDString()));
-                    arguments.push(new IntegerExp(exp.loc, exp.loc.linnum, Type.tint32));
-                    arguments.push(new StringExp(exp.loc, funcname.toDString()));
-                }
                 arguments.push((*exp.arguments)[0]);
                 arguments.push(new IntegerExp(exp.loc, isShared, Type.tbool));
 
@@ -5441,14 +5417,6 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                 lowering = new DotTemplateInstanceExp(exp.loc, lowering, hook, tiargs);
 
                 auto arguments = new Expressions();
-                if (global.params.tracegc)
-                {
-                    auto funcname = (sc.callsc && sc.callsc.func) ?
-                        sc.callsc.func.toPrettyChars() : sc.func.toPrettyChars();
-                    arguments.push(new StringExp(exp.loc, exp.loc.filename.toDString()));
-                    arguments.push(new IntegerExp(exp.loc, exp.loc.linnum, Type.tint32));
-                    arguments.push(new StringExp(exp.loc, funcname.toDString()));
-                }
 
                 arguments.push(new ArrayLiteralExp(exp.loc, Type.tsize_t.sarrayOf(nargs), exp.arguments));
                 arguments.push(new IntegerExp(exp.loc, tbn.isShared(), Type.tbool));
@@ -5832,8 +5800,8 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
             OutBuffer buf;
             foreach (idx, ref arg; *arguments)
                 buf.printf("%s%s", (idx ? ", ".ptr : "".ptr), arg.type.toChars());
-            error(exp.loc, "function literal `%s%s` is not callable using argument types `(%s)`",
-                      exp.fd.toChars(), parametersTypeToChars(tfl.parameterList),
+            error(exp.loc, "`%s` is not callable using argument types `(%s)`",
+                      exp.fd.toErrMsg(), // parametersTypeToChars(tfl.parameterList),
                       buf.peekChars());
             errorSupplemental(exp.loc, "too %s arguments, expected %d, got %d",
                                   arguments.length < dim ? "few".ptr : "many".ptr,
@@ -6038,7 +6006,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                 __gshared int nest;
                 if (++nest > global.recursionLimit)
                 {
-                    error(exp.loc, "recursive evaluation of `%s`", exp.toChars());
+                    error(exp.loc, "recursive evaluation of `%s`", exp.toErrMsg());
                     --nest;
                     return setError();
                 }
@@ -6331,7 +6299,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                 return null;
             if (f)
                 return f;
-            .error(loc, "no overload matches for `%s`", exp.toChars());
+            .error(loc, "no overload matches for `%s`", exp.toErrMsg());
             errorSupplemental(loc, "Candidates are:");
             foreach (s; os.a)
             {
@@ -6591,7 +6559,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
         }
         else if (!t1)
         {
-            error(exp.loc, "function expected before `()`, not `%s`", exp.e1.toChars());
+            error(exp.loc, "function expected before `()`, not `%s`", exp.e1.toErrMsg());
             return setError();
         }
         else if (t1.ty == Terror)
@@ -6674,7 +6642,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
             }
             else
             {
-                error(exp.loc, "function expected before `()`, not `%s` of type `%s`", exp.e1.toChars(), exp.e1.type.toChars());
+                error(exp.loc, "function expected before `()`, not `%s` of type `%s`", exp.e1.toErrMsg(), exp.e1.type.toChars());
                 return setError();
             }
 
@@ -6688,8 +6656,8 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                     tthis.modToBuffer(buf);
 
                 //printf("tf = %s, args = %s\n", tf.deco, (*arguments)[0].type.deco);
-                .error(exp.loc, "%s `%s%s` is not callable using argument types `%s`",
-                    p, exp.e1.toChars(), parametersTypeToChars(tf.parameterList), buf.peekChars());
+                .error(exp.loc, "%s `%s` is not callable using argument types `%s`",
+                    p, exp.e1.toErrMsg(), buf.peekChars());
                 if (failMessage)
                     errorSupplemental(exp.loc, "%s", failMessage);
             }
@@ -6712,20 +6680,20 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                 if (!tf.purity && sc.func.setImpure(exp.loc, "calling impure `%s`", exp.e1))
                 {
                     error(exp.loc, "`pure` %s `%s` cannot call impure %s `%s`",
-                        sc.func.kind(), sc.func.toPrettyChars(), p, exp.e1.toChars());
+                        sc.func.kind(), sc.func.toPrettyChars(), p, exp.e1.toErrMsg());
                     err = true;
                 }
                 if (!tf.isNogc && sc.func.setGC(exp.loc, "calling non-@nogc `%s`", exp.e1))
                 {
                     error(exp.loc, "`@nogc` %s `%s` cannot call non-@nogc %s `%s`",
-                        sc.func.kind(), sc.func.toPrettyChars(), p, exp.e1.toChars());
+                        sc.func.kind(), sc.func.toPrettyChars(), p, exp.e1.toErrMsg());
                     err = true;
                 }
                 if (tf.trust <= TRUST.system && sc.setUnsafe(true, exp.loc,
                     "calling `@system` `%s`", exp.e1))
                 {
                     error(exp.loc, "`@safe` %s `%s` cannot call `@system` %s `%s`",
-                        sc.func.kind(), sc.func.toPrettyChars(), p, exp.e1.toChars());
+                        sc.func.kind(), sc.func.toPrettyChars(), p, exp.e1.toErrMsg());
                     err = true;
                 }
                 if (err)
@@ -6770,7 +6738,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                     }
 
                     .error(exp.loc, "%s `%s` is not callable using argument types `%s`",
-                        exp.f.kind(), exp.f.toChars(), buf.peekChars());
+                        exp.f.kind(), exp.f.toErrMsg(), buf.peekChars());
                     if (failMessage)
                         errorSupplemental(exp.loc, "%s", failMessage);
                     .errorSupplemental(exp.f.loc, "`%s%s` declared here", exp.f.toPrettyChars(), parametersTypeToChars(tf.parameterList));
@@ -6846,7 +6814,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
         {
             exp.e1 = e1org; // https://issues.dlang.org/show_bug.cgi?id=10922
                         // avoid recursive expression printing
-            error(exp.loc, "forward reference to inferred return type of function call `%s`", exp.toChars());
+            error(exp.loc, "forward reference to inferred return type of function call `%s`", exp.toErrMsg());
             return setError();
         }
 
@@ -7126,7 +7094,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
         if (!ta)
         {
             //printf("ta %p ea %p sa %p\n", ta, ea, sa);
-            error(exp.loc, "no type for `typeid(%s)`", ea ? ea.toChars() : (sa ? sa.toChars() : ""));
+            error(exp.loc, "no type for `typeid(%s)`", ea ? ea.toErrMsg() : (sa ? sa.toChars() : ""));
             return setError();
         }
 
@@ -7798,7 +7766,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
             // 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());
+                e.toErrMsg());
         }
 
         const generateMsg = !exp.msg &&
@@ -8430,7 +8398,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                 MODMatchToBuffer(&thisBuf, e.e1.type.mod, tf.mod);
                 MODMatchToBuffer(&funcBuf, tf.mod, e.e1.type.mod);
                 error(e.loc, "%smethod `%s` is not callable using a %s`%s`",
-                    funcBuf.peekChars(), f.toPrettyChars(), thisBuf.peekChars(), e.e1.toChars());
+                    funcBuf.peekChars(), f.toPrettyChars(), thisBuf.peekChars(), e.e1.toErrMsg());
                 return setError();
             }
         }
@@ -8614,7 +8582,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
 
         if (!exp.e1.type)
         {
-            error(exp.loc, "cannot take address of `%s`", exp.e1.toChars());
+            error(exp.loc, "cannot take address of `%s`", exp.e1.toErrMsg());
             return setError();
         }
         if (!checkAddressable(exp, sc))
@@ -8638,7 +8606,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                     error(exp.loc, "forward reference to %s `%s`", d.kind(), d.toChars());
                 }
                 else
-                    error(exp.loc, "forward reference to type `%s` of expression `%s`", exp.e1.type.toChars(), exp.e1.toChars());
+                    error(exp.loc, "forward reference to type `%s` of expression `%s`", exp.e1.type.toChars(), exp.e1.toErrMsg());
                 return setError();
             }
         }
@@ -8801,7 +8769,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
         case Tarray:
             if (isNonAssignmentArrayOp(exp.e1))
                 goto default;
-            error(exp.loc, "using `*` on an array is no longer supported; use `*(%s).ptr` instead", exp.e1.toChars());
+            error(exp.loc, "using `*` on an array is no longer supported; use `*(%s).ptr` instead", exp.e1.toErrMsg());
             exp.type = (cast(TypeArray)tb).next;
             exp.e1 = exp.e1.castTo(sc, exp.type.pointerTo());
             break;
@@ -9111,7 +9079,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
 
         if (!exp.e1.type)
         {
-            error(exp.loc, "cannot cast `%s`", exp.e1.toChars());
+            error(exp.loc, "cannot cast `%s`", exp.e1.toErrMsg());
             return setError();
         }
 
@@ -9149,7 +9117,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
 
         if (exp.to.ty == Ttuple)
         {
-            error(exp.loc, "cannot cast `%s` of type `%s` to type sequence `%s`", exp.e1.toChars(), exp.e1.type.toChars(), exp.to.toChars());
+            error(exp.loc, "cannot cast `%s` of type `%s` to type sequence `%s`", exp.e1.toErrMsg(), exp.e1.type.toChars(), exp.to.toChars());
             return setError();
         }
 
@@ -9333,7 +9301,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
             if (elem.isConst() == 1)
                 return false;
 
-             error(exp.loc, "constant expression expected, not `%s`", elem.toChars());
+             error(exp.loc, "constant expression expected, not `%s`", elem.toErrMsg());
              return true;
         }
 
@@ -9393,7 +9361,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
         {
             if (exp.lwr || exp.upr)
             {
-                error(exp.loc, "cannot slice type `%s`", exp.e1.toChars());
+                error(exp.loc, "cannot slice type `%s`", exp.e1.toErrMsg());
                 return setError();
             }
             Expression e = new TypeExp(exp.loc, exp.e1.type.arrayOf());
@@ -9445,7 +9413,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
         {
             if (t1b.isPtrToFunction())
             {
-                error(exp.loc, "cannot slice function pointer `%s`", exp.e1.toChars());
+                error(exp.loc, "cannot slice function pointer `%s`", exp.e1.toErrMsg());
                 return setError();
             }
             if (!exp.lwr || !exp.upr)
@@ -9462,9 +9430,9 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                         {
                             errorSupplemental(exp.loc,
                                 "pointer `%s` points to an aggregate that defines an `%s`, perhaps you meant `(*%s)[]`",
-                                exp.e1.toChars(),
+                                exp.e1.toErrMsg(),
                                 s.ident.toChars(),
-                                exp.e1.toChars()
+                                exp.e1.toErrMsg()
                             );
                         }
 
@@ -9505,7 +9473,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
         }
         else
         {
-            error(exp.loc, "`%s` cannot be sliced with `[]`", t1b.ty == Tvoid ? exp.e1.toChars() : t1b.toChars());
+            error(exp.loc, "`%s` cannot be sliced with `[]`", t1b.ty == Tvoid ? exp.e1.toErrMsg() : t1b.toChars());
             return setError();
         }
 
@@ -9981,7 +9949,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
         case Tpointer:
             if (t1b.isPtrToFunction())
             {
-                error(exp.loc, "cannot index function pointer `%s`", exp.e1.toChars());
+                error(exp.loc, "cannot index function pointer `%s`", exp.e1.toErrMsg());
                 return setError();
             }
             exp.e2 = exp.e2.implicitCastTo(sc, Type.tsize_t);
@@ -10078,7 +10046,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                 return;
             }
         default:
-            error(exp.loc, "`%s` must be an array or pointer type, not `%s`", exp.e1.toChars(), exp.e1.type.toChars());
+            error(exp.loc, "`%s` must be an array or pointer type, not `%s`", exp.e1.toErrMsg(), exp.e1.type.toChars());
             return setError();
         }
 
@@ -10156,7 +10124,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
         if (exp.e1.op == EXP.slice)
         {
             const(char)* s = exp.op == EXP.plusPlus ? "increment" : "decrement";
-            error(exp.loc, "cannot post-%s array slice `%s`, use pre-%s instead", s, exp.e1.toChars(), s);
+            error(exp.loc, "cannot post-%s array slice `%s`, use pre-%s instead", s, exp.e1.toErrMsg(), s);
             return setError();
         }
 
@@ -10909,7 +10877,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                             if (newExp.newtype && newExp.newtype == t1)
                             {
                                 error(exp.loc, "cannot implicitly convert expression `%s` of type `%s` to `%s`",
-                                      newExp.toChars(), newExp.type.toChars(), t1.toChars());
+                                      newExp.toErrMsg(), newExp.type.toChars(), t1.toChars());
                                 errorSupplemental(exp.loc, "Perhaps remove the `new` keyword?");
                                 return setError();
                             }
@@ -11200,6 +11168,11 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
             exp.e2 = e2x;
             t1 = e1x.type.toBasetype();
         }
+        else if (t1.ty == Taarray)
+        {
+            // when assigning a constant, the need for TypeInfo might change
+            semanticTypeInfo(sc, t1);
+        }
         /* Check the mutability of e1.
          */
         if (auto ale = exp.e1.isArrayLengthExp())
@@ -11248,14 +11221,6 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
             id = id.expressionSemantic(sc);
 
             auto arguments = new Expressions();
-            arguments.reserve(5);
-            if (global.params.tracegc)
-            {
-                auto funcname = (sc.callsc && sc.callsc.func) ? sc.callsc.func.toPrettyChars() : sc.func.toPrettyChars();
-                arguments.push(new StringExp(exp.loc, exp.loc.filename.toDString()));
-                arguments.push(new IntegerExp(exp.loc, exp.loc.linnum, Type.tint32));
-                arguments.push(new StringExp(exp.loc, funcname.toDString()));
-            }
             arguments.push(ale.e1);
             arguments.push(exp.e2);
 
@@ -11282,7 +11247,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
             if (exp.op == EXP.assign && !tn.baseElemOf().isAssignable())
             {
                 error(exp.loc, "slice `%s` is not mutable, struct `%s` has immutable members",
-                    exp.e1.toChars(), tn.baseElemOf().toChars());
+                    exp.e1.toErrMsg(), tn.baseElemOf().toChars());
                 result = ErrorExp.get();
                 return;
             }
@@ -11305,7 +11270,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                 if (tn && !tn.baseElemOf().isAssignable())
                 {
                     error(exp.loc, "array `%s` is not mutable, struct `%s` has immutable members",
-                        exp.e1.toChars(), tn.baseElemOf().toChars());
+                        exp.e1.toErrMsg(), tn.baseElemOf().toChars());
                     result = ErrorExp.get();
                     return;
                 }
@@ -11375,7 +11340,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                 uinteger_t dim2 = tsa2.dim.toInteger();
                 if (dim1 != dim2)
                 {
-                    error(exp.loc, "mismatched array lengths %d and %d for assignment `%s`", cast(int)dim1, cast(int)dim2, exp.toChars());
+                    error(exp.loc, "mismatched array lengths %d and %d for assignment `%s`", cast(int)dim1, cast(int)dim2, exp.toErrMsg());
                     return setError();
                 }
             }
@@ -11451,7 +11416,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                         // offer more information about the cause of the problem
                         errorSupplemental(exp.loc,
                                           "`%s` is the first assignment of `%s` therefore it represents its initialization",
-                                          exp.toChars(), exp.e1.toChars());
+                                          exp.toErrMsg(), exp.e1.toErrMsg());
                         errorSupplemental(exp.loc,
                                           "`opAssign` methods are not used for initialization, but for subsequent assignments");
                     }
@@ -11973,15 +11938,6 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                 id = new DotIdExp(exp.loc, id, hook);
 
                 auto arguments = new Expressions();
-                arguments.reserve(5);
-                if (global.params.tracegc)
-                {
-                    auto funcname = (sc.callsc && sc.callsc.func) ? sc.callsc.func.toPrettyChars() : sc.func.toPrettyChars();
-                    arguments.push(new StringExp(exp.loc, exp.loc.filename.toDString()));
-                    arguments.push(new IntegerExp(exp.loc, exp.loc.linnum, Type.tint32));
-                    arguments.push(new StringExp(exp.loc, funcname.toDString()));
-                }
-
                 arguments.push(exp.e1);
                 arguments.push(exp.e2);
                 Expression ce = new CallExp(exp.loc, id, arguments);
@@ -12016,15 +11972,6 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                 id = new DotIdExp(exp.loc, id, hook);
 
                 auto arguments = new Expressions();
-                arguments.reserve(5);
-                if (global.params.tracegc)
-                {
-                    auto funcname = (sc.callsc && sc.callsc.func) ? sc.callsc.func.toPrettyChars() : sc.func.toPrettyChars();
-                    arguments.push(new StringExp(exp.loc, exp.loc.filename.toDString()));
-                    arguments.push(new IntegerExp(exp.loc, exp.loc.linnum, Type.tint32));
-                    arguments.push(new StringExp(exp.loc, funcname.toDString()));
-                }
-
                 Expression eValue1;
                 Expression value1 = extractSideEffect(sc, "__appendtmp", eValue1, exp.e1);
 
@@ -12368,7 +12315,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                     if (hook == Id._d_arraycatnTX)
                         arguments.pushSlice((*callExp.arguments)[]);
                     else
-                        arguments.pushSlice((*callExp.arguments)[3 .. $]);
+                        arguments.pushSlice((*callExp.arguments)[0 .. $ - 3]);
                 }
             }
             else
@@ -12376,15 +12323,6 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
         }
 
         auto arguments = new Expressions();
-        if (useTraceGCHook)
-        {
-            auto funcname = (sc.callsc && sc.callsc.func) ?
-                sc.callsc.func.toPrettyChars() : sc.func.toPrettyChars();
-            arguments.push(new StringExp(exp.loc, exp.loc.filename.toDString()));
-            arguments.push(new IntegerExp(exp.loc, exp.loc.linnum, Type.tint32));
-            arguments.push(new StringExp(exp.loc, funcname.toDString()));
-        }
-
         handleCatArgument(arguments, exp.e1, exp.type.toBasetype(), false);
         handleCatArgument(arguments, exp.e2, exp.type.toBasetype(), true);
 
@@ -12796,7 +12734,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
         Module mmath = Module.loadStdMath();
         if (!mmath)
         {
-            error(e.loc, "`%s` requires `std.math` for `^^` operators", e.toChars());
+            error(e.loc, "`%s` requires `std.math` for `^^` operators", e.toErrMsg());
             return setError();
         }
         e = new ScopeExp(exp.loc, mmath);
@@ -12970,7 +12908,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
 
         if (e2x.op == EXP.type || e2x.op == EXP.scope_)
         {
-            error(exp.loc, "`%s` is not an expression", exp.e2.toChars());
+            error(exp.loc, "`%s` is not an expression", exp.e2.toErrMsg());
             return setError();
         }
         if (e1x.op == EXP.error || e1x.type.ty == Tnoreturn)
@@ -13137,7 +13075,10 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
                     exp.e1 = exp.e1.implicitCastTo(sc, ta.index);
                 }
 
-                semanticTypeInfo(sc, ta.index);
+                // even though the glue layer only needs the type info of the index,
+                // this might be the first time an AA literal is accessed, so check
+                // the full type info
+                semanticTypeInfo(sc, ta);
 
                 // Return type is pointer to value
                 exp.type = ta.nextOf().pointerTo();
@@ -13152,7 +13093,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
             errorSupplemental(exp.loc, "`in` is only allowed on associative arrays");
             const(char)* slice = (t2b.ty == Tsarray) ? "[]" : "";
             errorSupplemental(exp.loc, "perhaps use `std.algorithm.find(%s, %s%s)` instead",
-                exp.e1.toChars(), exp.e2.toChars(), slice);
+                exp.e1.toErrMsg(), exp.e2.toErrMsg(), slice);
             return;
 
         default:
@@ -13374,8 +13315,9 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
         }
 
         if (exp.e1.type.toBasetype().ty == Taarray)
+        {
             semanticTypeInfo(sc, exp.e1.type.toBasetype());
-
+        }
 
         if (!target.isVectorOpSupported(t1, exp.op, t2))
         {
@@ -13998,12 +13940,12 @@ private Expression dotIdSemanticPropX(DotIdExp exp, Scope* sc)
     // Template has no built-in properties except for 'stringof'.
     if ((exp.e1.isDotTemplateExp() || exp.e1.isTemplateExp()) && exp.ident != Id.stringof)
     {
-        error(exp.loc, "template `%s` does not have property `%s`", exp.e1.toChars(), exp.ident.toChars());
+        error(exp.loc, "template `%s` does not have property `%s`", exp.e1.toErrMsg(), exp.ident.toChars());
         return ErrorExp.get();
     }
     if (!exp.e1.type)
     {
-        error(exp.loc, "expression `%s` does not have property `%s`", exp.e1.toChars(), exp.ident.toChars());
+        error(exp.loc, "expression `%s` does not have property `%s`", exp.e1.toErrMsg(), exp.ident.toChars());
         return ErrorExp.get();
     }
 
@@ -14405,7 +14347,7 @@ Expression dotTemplateSemanticProp(DotTemplateInstanceExp exp, Scope* sc, bool g
 
     Expression notTemplate()
     {
-        error(exp.loc, "`%s` isn't a template", e.toChars());
+        error(exp.loc, "`%s` isn't a template", e.toErrMsg());
         return errorExp();
     }
 
@@ -14720,7 +14662,7 @@ MATCH matchType(FuncExp funcExp, Type to, Scope* sc, FuncExp* presult, ErrorSink
     {
         auto ts = toAutoQualChars(tx, to);
         eSink.error(loc, "cannot implicitly convert expression `%s` of type `%s` to `%s`",
-            funcExp.toChars(), ts[0], ts[1]);
+            funcExp.toErrMsg(), ts[0], ts[1]);
     }
     return m;
 }
@@ -14733,7 +14675,7 @@ private bool checkScalar(Expression e)
         return true;
     if (!e.type.isScalar())
     {
-        error(e.loc, "`%s` is not a scalar, it is a `%s`", e.toChars(), e.type.toChars());
+        error(e.loc, "`%s` is not a scalar, it is a `%s`", e.toErrMsg(), e.type.toChars());
         return true;
     }
     return e.checkValue();
@@ -14747,7 +14689,7 @@ private bool checkNoBool(Expression e)
         return true;
     if (e.type.toBasetype().ty == Tbool)
     {
-        error(e.loc, "operation not allowed on `bool` `%s`", e.toChars());
+        error(e.loc, "operation not allowed on `bool` `%s`", e.toErrMsg());
         return true;
     }
     return false;
@@ -14761,7 +14703,7 @@ private bool checkIntegral(Expression e)
         return true;
     if (!e.type.isIntegral())
     {
-        error(e.loc, "`%s` is not of integral type, it is a `%s`", e.toChars(), e.type.toChars());
+        error(e.loc, "`%s` is not of integral type, it is a `%s`", e.toErrMsg(), e.type.toChars());
         return true;
     }
     return e.checkValue();
@@ -14779,7 +14721,7 @@ private bool checkArithmetic(Expression e, EXP op)
         const char* msg = e.type.isAggregate() ?
             "operator `%s` is not defined for `%s` of type `%s`" :
             "illegal operator `%s` for `%s` of type `%s`";
-        error(e.loc, msg, EXPtoString(op).ptr, e.toChars(), e.type.toChars());
+        error(e.loc, msg, EXPtoString(op).ptr, e.toErrMsg(), e.type.toChars());
         return true;
     }
 
@@ -14862,7 +14804,7 @@ bool checkValue(Expression e)
 {
     if (auto te = e.isTypeExp())
     {
-        error(e.loc, "type `%s` has no value", e.toChars());
+        error(e.loc, "type `%s` has no value", e.toErrMsg());
         if (!e.type.isOpaqueType)
             errorSupplemental(e.loc, "perhaps use `%s.init`", e.toChars());
         return true;
@@ -14874,7 +14816,7 @@ bool checkValue(Expression e)
             dtie.ti.semantictiargsdone &&
             dtie.ti.semanticRun == PASS.initial)
 
-            error(e.loc, "partial %s `%s` has no value", dtie.ti.kind(), e.toChars());
+            error(e.loc, "partial %s `%s` has no value", dtie.ti.kind(), e.toErrMsg());
         else
             error(e.loc, "%s `%s` has no value", dtie.ti.kind(), dtie.ti.toChars());
         return true;
@@ -14904,13 +14846,13 @@ bool checkValue(Expression e)
 
     if (auto dte = e.isDotTemplateExp())
     {
-        error(e.loc, "%s `%s` has no value", dte.td.kind(), e.toChars());
+        error(e.loc, "%s `%s` has no value", dte.td.kind(), e.toErrMsg());
         return true;
     }
 
     if (e.type && e.type.toBasetype().ty == Tvoid)
     {
-        error(e.loc, "expression `%s` is `void` and has no value", e.toChars());
+        error(e.loc, "expression `%s` is `void` and has no value", e.toErrMsg());
         //print(); assert(0);
         if (!global.gag)
             e.type = Type.terror;
@@ -14970,7 +14912,7 @@ bool checkSharedAccess(Expression e, Scope* sc, bool returnRef = false)
         bool sharedError(Expression e)
         {
             // https://dlang.org/phobos/core_atomic.html
-            error(e.loc, "direct access to shared `%s` is not allowed, see `core.atomic`", e.toChars());
+            error(e.loc, "direct access to shared `%s` is not allowed, see `core.atomic`", e.toErrMsg());
             return true;
         }
 
@@ -15494,9 +15436,9 @@ private Expression toLvalueImpl(Expression _this, Scope* sc, const(char)* action
         if (e.op == EXP.type)
             error(_this.loc, "cannot %s type `%s`", action, e.type.toChars());
         else if (e.op == EXP.template_)
-            error(_this.loc, "cannot %s template `%s`, perhaps instantiate it first", action, e.toChars());
+            error(_this.loc, "cannot %s template `%s`, perhaps instantiate it first", action, e.toErrMsg());
         else
-            error(_this.loc, "cannot %s expression `%s` because it is not an lvalue", action, e.toChars());
+            error(_this.loc, "cannot %s expression `%s` because it is not an lvalue", action, e.toErrMsg());
 
         return ErrorExp.get();
     }
@@ -15505,7 +15447,7 @@ private Expression toLvalueImpl(Expression _this, Scope* sc, const(char)* action
     {
         if (!_this.loc.isValid())
             _this.loc = e.loc;
-        error(e.loc, "cannot %s constant `%s`", action, e.toChars());
+        error(e.loc, "cannot %s constant `%s`", action, e.toErrMsg());
         return ErrorExp.get();
     }
 
@@ -15930,12 +15872,12 @@ private Expression modifiableLvalueImpl(Expression _this, Scope* sc, Expression
                             break;
                         if (!ff.type.isMutable)
                         {
-                            error(exp.loc, "cannot modify `%s` in `%s` function", exp.toChars(), MODtoChars(type.mod));
+                            error(exp.loc, "cannot modify `%s` in `%s` function", exp.toErrMsg(), MODtoChars(type.mod));
                             return ErrorExp.get();
                         }
                     }
                 }
-                error(exp.loc, "cannot modify `%s` expression `%s`", MODtoChars(type.mod), exp.toChars());
+                error(exp.loc, "cannot modify `%s` expression `%s`", MODtoChars(type.mod), exp.toErrMsg());
                 return ErrorExp.get();
             }
             else if (!type.isAssignable())
@@ -15950,7 +15892,7 @@ private Expression modifiableLvalueImpl(Expression _this, Scope* sc, Expression
 
     Expression visitString(StringExp exp)
     {
-        error(exp.loc, "cannot modify string literal `%s`", exp.toChars());
+        error(exp.loc, "cannot modify string literal `%s`", exp.toErrMsg());
         return ErrorExp.get();
     }
 
@@ -15959,7 +15901,7 @@ private Expression modifiableLvalueImpl(Expression _this, Scope* sc, Expression
         //printf("VarExp::modifiableLvalue('%s')\n", exp.var.toChars());
         if (exp.var.storage_class & STC.manifest)
         {
-            error(exp.loc, "cannot modify manifest constant `%s`", exp.toChars());
+            error(exp.loc, "cannot modify manifest constant `%s`", exp.toErrMsg());
             return ErrorExp.get();
         }
         // See if this expression is a modifiable lvalue (i.e. not const)
@@ -15988,7 +15930,7 @@ private Expression modifiableLvalueImpl(Expression _this, Scope* sc, Expression
 
     Expression visitSlice(SliceExp exp)
     {
-        error(exp.loc, "slice expression `%s` is not a modifiable lvalue", exp.toChars());
+        error(exp.loc, "slice expression `%s` is not a modifiable lvalue", exp.toErrMsg());
         return exp;
     }
 
@@ -16030,7 +15972,7 @@ private Expression modifiableLvalueImpl(Expression _this, Scope* sc, Expression
     {
         if (!exp.e1.isLvalue() && !exp.e2.isLvalue())
         {
-            error(exp.loc, "conditional expression `%s` is not a modifiable lvalue", exp.toChars());
+            error(exp.loc, "conditional expression `%s` is not a modifiable lvalue", exp.toErrMsg());
             return ErrorExp.get();
         }
         exp.e1 = exp.e1.modifiableLvalue(sc);
@@ -16071,7 +16013,7 @@ private bool checkAddressVar(Scope* sc, Expression exp, VarDeclaration v)
 
     if (!v.canTakeAddressOf())
     {
-        error(exp.loc, "cannot take address of `%s`", exp.toChars());
+        error(exp.loc, "cannot take address of `%s`", exp.toErrMsg());
         return false;
     }
     if (sc.func && !sc.intypeof && !v.isDataseg())
@@ -16133,9 +16075,9 @@ bool checkAddressable(Expression e, Scope* sc)
                     if (ex.isVarExp().var.storage_class & STC.register)
                     {
                         if (e.isIndexExp())
-                            error(e.loc, "cannot index through register variable `%s`", ex.toChars());
+                            error(e.loc, "cannot index through register variable `%s`", ex.toErrMsg());
                         else
-                            error(e.loc, "cannot take address of register variable `%s`", ex.toChars());
+                            error(e.loc, "cannot take address of register variable `%s`", ex.toErrMsg());
                         return false;
                     }
                 }
@@ -16629,7 +16571,7 @@ bool evalStaticCondition(Scope* sc, Expression original, Expression e, out bool
         if (opt.isEmpty())
         {
             if (!e.type.isTypeError())
-                error(e.loc, "expression `%s` is not constant", e.toChars());
+                error(e.loc, "expression `%s` is not constant", e.toErrMsg());
             errors = true;
             return false;
         }
@@ -16916,6 +16858,9 @@ void semanticTypeInfo(Scope* sc, Type t)
     {
         semanticTypeInfo(sc, t.index);
         semanticTypeInfo(sc, t.next);
+
+        if (global.params.useTypeInfo)
+            getTypeInfoType(t.loc, t, sc);
     }
 
     void visitStruct(TypeStruct t)
index 7f39ec91f0232372387db3eec3284519316e48d0..f2116e585d8e3eec04c56fa6c500d5c2aac5469d 100644 (file)
@@ -101,8 +101,10 @@ private struct PathCache
          */
         bool exists = true;
         auto st = PathStack(filespec);
-        while (st.up) {
-            if (auto cached = pathStatus.lookup(st.cur)) {
+        while (st.up)
+        {
+            if (auto cached = pathStatus.lookup(st.cur))
+            {
                 exists = cached.value;
                 break;
             }
@@ -112,7 +114,8 @@ private struct PathCache
          * Once a directory is found to not exist, all the directories
          * to the right of it do not exist
          */
-        while (st.down) {
+        while (st.down)
+        {
             if (!exists)
                 pathStatus.insert(st.cur, false);
             else
@@ -218,17 +221,19 @@ nothrow:
 
             const(char)[] n = FileName.combine(p, sdi);
 
-            if (!pathCache.pathExists(n)) {
+            if (!pathCache.pathExists(n))
+            {
                 FileName.free(n.ptr);
                 continue; // no need to check for anything else.
             }
-            if (FileName.exists(n) == 1) {
+            if (FileName.exists(n) == 1)
                 return n;
-            }
+
             FileName.free(n.ptr);
 
             n = FileName.combine(p, sd);
-            if (FileName.exists(n) == 1) {
+            if (FileName.exists(n) == 1)
+            {
                 whichPathFoundThis = pathIndex;
                 return n;
             }
@@ -241,14 +246,16 @@ nothrow:
             if (pathCache.isExistingPath(n))
             {
                 const n2i = FileName.combine(n, package_di);
-                if (FileName.exists(n2i) == 1) {
+                if (FileName.exists(n2i) == 1)
+                {
                     whichPathFoundThis = pathIndex;
                     return n2i;
                 }
 
                 FileName.free(n2i.ptr);
                 const n2 = FileName.combine(n, package_d);
-                if (FileName.exists(n2) == 1) {
+                if (FileName.exists(n2) == 1)
+                {
                     whichPathFoundThis = pathIndex;
                     return n2;
                 }
@@ -272,14 +279,16 @@ nothrow:
             const p = entry.path.toDString();
 
             const(char)[] n = FileName.combine(p, si);
-            if (FileName.exists(n) == 1) {
+            if (FileName.exists(n) == 1)
+            {
                 whichPathFoundThis = pathIndex;
                 return n;
             }
             FileName.free(n.ptr);
 
             n = FileName.combine(p, sc);
-            if (FileName.exists(n) == 1) {
+            if (FileName.exists(n) == 1)
+            {
                 whichPathFoundThis = pathIndex;
                 return n;
             }
index 80312f2f3c55b20e0ab126fb9313deedb6e1f362..e5b72e2bb3ceb009979ad7070b8291162ebd430d 100644 (file)
@@ -1883,10 +1883,10 @@ struct AttributeViolation
         assert(args.length <= 4); // expand if necessary
         OutBuffer buf;
         buf.printf(fmt,
-            args.length > 0 && args[0] ? args[0].toChars() : "",
-            args.length > 1 && args[1] ? args[1].toChars() : "",
-            args.length > 2 && args[2] ? args[2].toChars() : "",
-            args.length > 3 && args[3] ? args[3].toChars() : "",
+            args.length > 0 && args[0] ? args[0].toErrMsg() : "",
+            args.length > 1 && args[1] ? args[1].toErrMsg() : "",
+            args.length > 2 && args[2] ? args[2].toErrMsg() : "",
+            args.length > 3 && args[3] ? args[3].toErrMsg() : "",
         );
         this.action = buf.extractSlice();
     }
index c0fcf64be3188d879cc3ad1ef03e9d2041e05c8a..0ef955a033964c67480ab21ee03c0e61511962ab 100644 (file)
@@ -59,10 +59,12 @@ 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 inCAlias;      /// Set to prevent ImportC translating typedefs as `alias X = X`
     bool doFuncBodies;  /// include function bodies in output
     bool vcg_ast;       /// write out codegen-ast
     bool skipConstraints;  // skip constraints when doing templates
     bool showOneMember = true;
+    bool errorMsg;      /// true if formatting for inside an error message
 
     bool fullQual;      /// fully qualify types when printing
     int tpltMember;
@@ -96,6 +98,87 @@ void genhdrfile(Module m, bool doFuncBodies, ref OutBuffer buf)
     toCBuffer(m, buf, hgs);
 }
 
+/**
+ * Convert `o` to a string for error messages.
+ * Params:
+ *      e = object to convert
+ * Returns: string representation of `e`
+ */
+const(char)* toErrMsg(const RootObject o)
+{
+    if (auto e = o.isExpression())
+        return toErrMsg(e);
+    if (auto d = o.isDsymbol())
+        return toErrMsg(d);
+    if (auto t = o.isType())
+        return t.toChars();
+    if (auto id = o.isIdentifier())
+        return id.toChars();
+    assert(0);
+}
+
+/// ditto
+const(char)* toErrMsg(const Expression e)
+{
+    HdrGenState hgs;
+    hgs.errorMsg = true;
+    OutBuffer buf;
+    toCBuffer(e, buf, hgs);
+    truncateForError(buf, 60);
+
+    return buf.extractChars();
+}
+
+/// ditto
+const(char)* toErrMsg(const Dsymbol d)
+{
+    if (d.isFuncDeclaration() || d.isTemplateInstance())
+    {
+        if (d.ident && d.ident.toString.startsWith("__") && !d.isCtorDeclaration())
+        {
+            HdrGenState hgs;
+            hgs.errorMsg = true;
+            OutBuffer buf;
+            toCBuffer(cast() d, buf, hgs);
+            truncateForError(buf, 80);
+            return buf.extractChars();
+        }
+    }
+
+    return d.toChars();
+}
+
+/**
+ * Make the content of `buf` fit inline for an error message.
+ * Params:
+ *   buf = buffer with text to modify
+ *   maxLength = truncate text when it exceeds this length
+ */
+private void truncateForError(ref OutBuffer buf, size_t maxLength)
+{
+    // Remove newlines, escape backticks ` by doubling them
+    for (size_t i = 0; i < buf.length; i++)
+    {
+        if (buf[i] == '\r')
+            buf.remove(i, 1);
+        if (buf[i] == '\n')
+            buf.peekSlice[i] = ' ';
+        if (buf[i] == '`')
+            i = buf.insert(i, "`");
+    }
+
+    // Strip trailing whitespace
+    while (buf.length && buf[$-1] == ' ')
+        buf.setsize(buf.length - 1);
+
+    // Truncate
+    if (buf.length > maxLength)
+    {
+        buf.setsize(maxLength - 3);
+        buf.writestring("...");
+    }
+}
+
 /***************************************
  * Turn a Statement into a string suitable for printf.
  * Leaks memory.
@@ -1658,7 +1741,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
     {
         if (d.storage_class & STC.local)
             return;
-        if (d.adFlags & d.hidden)
+        if (d.hidden)
             return;
         buf.writestring("alias ");
         if (d.aliassym)
@@ -1695,7 +1778,9 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
             buf.writestring(" = ");
             if (stcToBuffer(buf, d.storage_class))
                 buf.writeByte(' ');
+            hgs.inCAlias = hgs.importcHdr;
             typeToBuffer(d.type, null, buf, hgs);
+            hgs.inCAlias = false;
             hgs.declstring = false;
         }
         buf.writeByte(';');
@@ -1772,7 +1857,7 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
             buf.writestring("__error");
             return;
         }
-        if (f.tok != TOK.reserved)
+        if (f.tok != TOK.reserved && !hgs.errorMsg)
         {
             buf.writestring(f.kind());
             buf.writeByte(' ');
@@ -1789,8 +1874,9 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
             buf.writeByte(' ');
             buf.writestring(str);
         }
-        tf.attributesApply(&printAttribute);
 
+        if (!hgs.errorMsg)
+            tf.attributesApply(&printAttribute);
 
         CompoundStatement cs = f.fbody.isCompoundStatement();
         Statement s1;
@@ -4366,6 +4452,11 @@ private void typeToBufferx(Type t, ref OutBuffer buf, ref HdrGenState hgs)
         buf.writestring("noreturn");
     }
 
+    if (hgs.importcHdr && !hgs.inCAlias && t.mcache && t.mcache.typedefIdent)
+    {
+        buf.writestring(t.mcache.typedefIdent.toString());
+        return;
+    }
 
     switch (t.ty)
     {
index 9833e1980ed98c2042a099b1754ae3feec587c5e..fa7fe1d5eda12011e5dc4f53f60cb9e1188ac409 100644 (file)
@@ -166,6 +166,7 @@ immutable Msgtable[] msgtable =
     { "xopCmp", "__xopCmp" },
     { "xtoHash", "__xtoHash" },
     { "__tmpfordtor" },
+    { "Entry" },
 
     { "LINE", "__LINE__" },
     { "FILE", "__FILE__" },
index 231aa5832fdb262acbac38c3eb09d5b084867b74..9ef8285f8ea7a5e2e267a0517809124d9231f657 100644 (file)
@@ -248,13 +248,14 @@ nothrow:
          * directly, but that would unnecessary lengthen symbols names. See issue:
          * https://issues.dlang.org/show_bug.cgi?id=23722
          */
-        static struct Key { uint fileOffset; string prefix; string parent; }
+        static struct Key { string locKey; string prefix; string parent; }
         __gshared uint[Key] counters;
 
+        string locKey = cast(string) (sl.filename ~ idBuf[]);
         static if (__traits(compiles, counters.update(Key.init, () => 0u, (ref uint a) => 0u)))
         {
             // 2.082+
-            counters.update(Key(loc.fileOffset, prefix, parent),
+            counters.update(Key(locKey, prefix, parent),
                 () => 1u,          // insertion
                 (ref uint counter) // update
                 {
@@ -266,7 +267,7 @@ nothrow:
         }
         else
         {
-            const key = Key(loc.fileOffset, prefix, parent);
+            const key = Key(locKey, prefix, parent);
             if (auto pCounter = key in counters)
             {
                 idBuf.writestring("_");
index 467b7966074f6b1954670432b56f53f487ad21ab..cda4088cb1775ec8dcba8ae9f73a2fedfdc0e6e3 100644 (file)
@@ -585,7 +585,7 @@ Initializer initializerSemantic(Initializer init, Scope* sc, ref Type tx, NeedIn
             const errors = global.startGagging();
             i.exp = i.exp.implicitCastTo(sc, t);
             if (global.endGagging(errors))
-                error(currExp.loc, "cannot implicitly convert expression `%s` of type `%s` to `%s`", currExp.toChars(), et.toChars(), t.toChars());
+                error(currExp.loc, "cannot implicitly convert expression `%s` of type `%s` to `%s`", currExp.toErrMsg(), et.toChars(), t.toChars());
         }
         }
     L1:
index 05924f7b8b7b7f2ff0c9ad3980037653d0ed5b0f..490032066e03fb51d404d2b233c6956d6c21652b 100644 (file)
@@ -41,10 +41,13 @@ import dmd.root.string;
 import dmd.target;
 import dmd.visitor;
 
-version(Windows) {
+version(Windows)
+{
     extern (C) char* _getcwd(char* buffer, size_t maxlen);
     alias getcwd = _getcwd;
-} else {
+}
+else
+{
     import core.sys.posix.unistd : getcwd;
 }
 
index 90c794e240555e6f9512876012976b6964a9851e..96a17805d2bdf35d3be0808941eceb8c47ae6efb 100644 (file)
@@ -445,7 +445,8 @@ public:
             visitType(p.type);
     }
 
-    override void visit(StructLiteralExp e) {
+    override void visit(StructLiteralExp e)
+    {
         static if (LOG)
             printf("StructLiteralExp: %s\n", e.toChars);
 
index 61b4f414c1f0c443d9ec368ccd36a1a6877c134a..51e597c4130051531487f62618af26ab415139f6 100644 (file)
@@ -867,7 +867,7 @@ class Lexer
                             case 0:
                             case 0x1A:
                                 error(t.loc, "unterminated /* */ comment");
-                                p = end;
+                                //p = end;
                                 t.loc = loc();
                                 t.value = TOK.endOfFile;
                                 return;
@@ -927,7 +927,7 @@ class Lexer
                                 getDocComment(t, lastLine == startLoc.linnum, startLoc.linnum - lastDocLine > 1);
                                 lastDocLine = linnum;
                             }
-                            p = end;
+                            //p = end;
                             t.loc = loc();
                             t.value = TOK.endOfFile;
                             return;
@@ -1003,7 +1003,7 @@ class Lexer
                             case 0:
                             case 0x1A:
                                 error(t.loc, "unterminated /+ +/ comment");
-                                p = end;
+                                //p = end;
                                 t.loc = loc();
                                 t.value = TOK.endOfFile;
                                 return;
@@ -3441,9 +3441,8 @@ class Lexer
         int linestart = 0;
         if (ct == '/')
         {
-            if (q < qend && *q == ' ') {
+            if (q < qend && *q == ' ')
                 ++q;
-            }
         }
         else if (q < qend)
         {
index 8a27541a72e85e73f80bf9f4f7f28a29ace27301..ef5430ffa23e28c8948b0a70f8e5663247ce3ec6 100644 (file)
@@ -64,7 +64,7 @@ nothrow:
     extern (C++) static Loc singleFilename(const char* filename)
     {
         Loc result;
-        locFileTable ~= BaseLoc(filename.toDString, locIndex, 0, [0]);
+        locFileTable ~= new BaseLoc(filename.toDString, locIndex, 0, [0]);
         result.index = locIndex++;
         return result;
     }
@@ -95,7 +95,19 @@ nothrow:
      */
     extern (C++) const(char)* filename() const @nogc
     {
-        return SourceLoc(this).filename.ptr; // _filename;
+        if (this.index == 0)
+            return null;
+
+        const i = fileTableIndex(this.index);
+        if (locFileTable[i].substitutions.length > 0)
+        {
+            const si = locFileTable[i].getSubstitutionIndex(this.index - locFileTable[i].startIndex);
+            const fname = locFileTable[i].substitutions[si].filename;
+            if (fname.length > 0)
+                return fname.ptr;
+        }
+
+        return locFileTable[i].filename.ptr;
     }
 
     extern (C++) const(char)* toChars(
@@ -293,11 +305,11 @@ private size_t fileTableIndex(uint index) nothrow @nogc
  */
 BaseLoc* newBaseLoc(const(char)* filename, size_t size) nothrow
 {
-    locFileTable ~= BaseLoc(filename.toDString, locIndex, 1, [0]);
+    locFileTable ~= new BaseLoc(filename.toDString, locIndex, 1, [0]);
     // Careful: the endloc of a FuncDeclaration can
     // point to 1 past the very last byte in the file, so account for that
     locIndex += size + 1;
-    return &locFileTable[$ - 1];
+    return locFileTable[$ - 1];
 }
 
 /**
@@ -385,7 +397,23 @@ struct BaseLoc
         if (substitutions.length == 0)
             return loc;
 
-        const offset = loc.fileOffset;
+        const i = getSubstitutionIndex(loc.fileOffset);
+        if (substitutions[i].filename.length > 0)
+            loc.filename = substitutions[i].filename;
+        loc.linnum += substitutions[i].startLine;
+        return loc;
+    }
+
+    /// Resolve an offset into this file to a filename + line + column
+    private SourceLoc getSourceLoc(uint offset) @nogc
+    {
+        const i = getLineIndex(offset);
+        const sl = SourceLoc(filename, cast(int) (i + startLine), cast(int) (1 + offset - lines[i]), offset);
+        return substitute(sl);
+    }
+
+    private size_t getSubstitutionIndex(uint offset) @nogc
+    {
         size_t lo = 0;
         size_t hi = substitutions.length + -1;
         size_t mid = 0;
@@ -395,12 +423,7 @@ struct BaseLoc
             if (substitutions[mid].startIndex <= offset)
             {
                 if (mid == substitutions.length - 1 || substitutions[mid + 1].startIndex > offset)
-                {
-                    if (substitutions[mid].filename.length > 0)
-                        loc.filename = substitutions[mid].filename;
-                    loc.linnum += substitutions[mid].startLine;
-                    return loc;
-                }
+                    return mid;
 
                 lo = mid + 1;
             }
@@ -412,14 +435,6 @@ struct BaseLoc
         assert(0);
     }
 
-    /// Resolve an offset into this file to a filename + line + column
-    private SourceLoc getSourceLoc(uint offset) @nogc
-    {
-        const i = getLineIndex(offset);
-        const sl = SourceLoc(filename, cast(int) (i + startLine), cast(int) (1 + offset - lines[i]), offset);
-        return substitute(sl);
-    }
-
     /// Binary search the index in `this.lines` corresponding to `offset`
     private size_t getLineIndex(uint offset) @nogc
     {
@@ -449,4 +464,4 @@ struct BaseLoc
 private __gshared uint locIndex = 1;
 
 // Global mapping of Loc indices to source file offset/line/column, see `BaseLoc`
-private __gshared BaseLoc[] locFileTable;
+private __gshared BaseLoc*[] locFileTable;
index 1cebcc8de6479da1625056de524f3e6945631f08..84899d003ca2541633693a97021eda7a58ef39c6 100644 (file)
@@ -299,13 +299,16 @@ extern (C++) abstract class Type : ASTNode
         Type wcto;      // MODFlags.wildconst
         Type swto;      // MODFlags.shared_ | MODFlags.wild
         Type swcto;     // MODFlags.shared_ | MODFlags.wildconst
+        Type pto;       // merged pointer to this type
+        Type rto;       // reference to this type
+        Type arrayof;   // array of this type
+
+        // ImportC: store the name of the typedef resolving to this type
+        // So `uint8_t x;` will be printed as `uint8_t x;` and not as the resolved `ubyte x;`
+        Identifier typedefIdent;
     }
     Mcache* mcache;
 
-    Type pto;       // merged pointer to this type
-    Type rto;       // reference to this type
-    Type arrayof;   // array of this type
-
     TypeInfoDeclaration vtinfo;     // TypeInfo object for this Type
 
     void* ctype;                    // for back end
@@ -762,9 +765,6 @@ extern (C++) abstract class Type : ASTNode
         memcpy(cast(void*)t, cast(void*)this, sz);
         // t.mod = NULL;  // leave mod unchanged
         t.deco = null;
-        t.arrayof = null;
-        t.pto = null;
-        t.rto = null;
         t.vtinfo = null;
         t.ctype = null;
         t.mcache = null;
@@ -2959,9 +2959,6 @@ extern (C++) final class TypeIdentifier : TypeQualified
 {
     Identifier ident;
 
-    // The symbol representing this identifier, before alias resolution
-    Dsymbol originalSymbol;
-
     extern (D) this(Loc loc, Identifier ident)
     {
         super(Tident, loc);
@@ -3870,7 +3867,8 @@ extern (C++) struct ParameterList
         foreach (_, p1; cast() this)
         {
             auto p2 = other[idx++];
-            if (!p2 || p1 != p2) {
+            if (!p2 || p1 != p2)
+            {
                 diff = true;
                 break;
             }
index 0cf08e74884b983e2330324f8a66d786cdfb8fe9..990f8d4d70d54e8f9e2a8a870bd784e9b0ad88d4 100644 (file)
@@ -146,9 +146,6 @@ public:
     MOD mod;  // modifiers MODxxxx
     char *deco;
     void* mcache;
-    Type *pto;          // merged pointer to this type
-    Type *rto;          // reference to this type
-    Type *arrayof;      // array of this type
     TypeInfoDeclaration *vtinfo;        // TypeInfo object for this Type
 
     type *ctype;        // for back end
@@ -630,7 +627,6 @@ class TypeIdentifier final : public TypeQualified
 {
 public:
     Identifier *ident;
-    Dsymbol *originalSymbol; // The symbol representing this identifier, before alias resolution
 
     static TypeIdentifier *create(Loc loc, Identifier *ident);
     const char *kind() override;
index 121f9900f2e6f7779793e0d58a02ac8c90947a48..33e0e5a113108011a9cf9106ed862bca09aaeac7 100644 (file)
@@ -1041,6 +1041,30 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
                 nextToken();
                 continue;
 
+            // The following are all errors, the cases are just for better error messages than the default case
+            case TOK.return_:
+            case TOK.goto_:
+            case TOK.break_:
+            case TOK.continue_:
+                error("`%s` statement must be inside function scope", token.toChars());
+                goto Lerror;
+            case TOK.asm_:
+            case TOK.do_:
+            case TOK.for_:
+            case TOK.foreach_:
+            case TOK.foreach_reverse_:
+            case TOK.if_:
+            case TOK.switch_:
+            case TOK.try_:
+            case TOK.while_:
+                error("`%s` statement must be inside function scope", token.toChars());
+                if (peekNext() == TOK.leftParenthesis || peekNext() == TOK.leftCurly)
+                {
+                    parseStatement(0);
+                    s = null;
+                    continue;
+                }
+                goto Lerror;
             default:
                 error("declaration expected, not `%s`", token.toChars());
             Lerror:
@@ -1504,28 +1528,26 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
         if (token.value != TOK.identifier)
         {
             error("identifier expected following `template`");
-            goto Lerr;
+            return null;
         }
         id = token.ident;
         nextToken();
         tpl = parseTemplateParameterList();
         if (!tpl)
-            goto Lerr;
+            return null;
 
         constraint = parseConstraint();
 
         if (token.value != TOK.leftCurly)
         {
             error("`{` expected after template parameter list, not `%s`", token.toChars()); /* } */
-            goto Lerr;
+            nextToken();
+            return null;
         }
         decldefs = parseBlock(null);
 
         tempdecl = new AST.TemplateDeclaration(loc, id, tpl, constraint, decldefs, ismixin);
         return tempdecl;
-
-    Lerr:
-        return null;
     }
 
     /******************************************
@@ -4509,7 +4531,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
             if (ident)
                 checkCstyleTypeSyntax(loc, t, alt, ident);
             else if (!isThis && (t != AST.Type.terror))
-                noIdentifierForDeclarator(t);
+                noIdentifierForDeclarator(t, token);
 
             if (isAliasDeclaration)
             {
@@ -4571,6 +4593,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
 
                 default:
                     error("semicolon expected to close `alias` declaration, not `%s`", token.toChars());
+                    nextToken();
                     break;
                 }
             }
@@ -4734,11 +4757,12 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
         return a;
     }
 
-    /// Report an error that a declaration of type `t` is missing an identifier
+    /// Report an error that a declaration of type `t` is missing an identifier and got `tok` instead
     /// The parser is expected to sit on the next token after the type.
-    private void noIdentifierForDeclarator(AST.Type t)
+    private void noIdentifierForDeclarator(AST.Type t, Token tok)
     {
-        error("no identifier for declarator `%s`", t.toChars());
+        error("variable name expected after type `%s`, not `%s`", t.toChars(), tok.toChars);
+
         // A common mistake is to use a reserved keyword as an identifier, e.g. `in` or `out`
         if (token.isKeyword)
         {
@@ -5016,6 +5040,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
 
                 default:
                     error("semicolon expected to close `alias` declaration, not `%s`", token.toChars());
+                    nextToken();
                     break;
                 }
                 break;
@@ -5356,9 +5381,14 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
                         error("template constraint must follow parameter lists and attributes");
                     else
                         error("cannot use function constraints for non-template functions. Use `static if` instead");
+
+                    parseConstraint();
                 }
                 else
+                {
                     error("semicolon expected following function declaration, not `%s`", token.toChars());
+                    nextToken();
+                }
             }
             break;
         }
@@ -5542,7 +5572,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
             }
             at = parseType(&ai);
             if (!ai)
-                noIdentifierForDeclarator(at);
+                noIdentifierForDeclarator(at, token);
         Larg:
             auto p = new AST.Parameter(aloc, storageClass, at, ai, null, null);
             parameters.push(p);
index 847af0eab61bd5fbdf5d179e822966eba78b4497..be606c41f7d786270991a67f33e758aa8de6f37e 100644 (file)
@@ -377,9 +377,9 @@ auto splitLines(const char[] text)
         public const(char)[] front()
         {
             advance();
-            if (index > eolIndex || index >= text.length) {
+            if (index > eolIndex || index >= text.length)
                 return "";
-            }
+
             return text[index .. eolIndex];
         }
 
index 31fc418dbcc32b9e44dcfd257fab8bf7ee88fc28..893dc1b9d7bb574fd1df20c96bd36a6eb77f8e70 100644 (file)
@@ -852,6 +852,8 @@ private extern(C++) final class StaticAAVisitor : SemanticTimeTransitiveVisitor
         loweredExp = loweredExp.ctfeInterpret();
 
         aaExp.lowering = loweredExp;
+
+        semanticTypeInfo(sc, loweredExp.type);
     }
 
     // https://issues.dlang.org/show_bug.cgi?id=24602
index 5d7f8bc328246c10640a38ad464fabc353d40c18..f7a7ce150b326b9baeddbda63b007d08bbae7baf 100644 (file)
@@ -380,7 +380,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
                     if (!sc.intypeof)
                     {
                         if (fld.tok == TOK.delegate_)
-                            .error(funcdecl.loc, "%s `%s` cannot be %s members", funcdecl.kind, funcdecl.toPrettyChars, ad.kind());
+                            .error(funcdecl.loc, "%s `%s` cannot be %s members", funcdecl.kind, funcdecl.toErrMsg, ad.kind());
                         else
                             fld.tok = TOK.function_;
                     }
@@ -933,7 +933,37 @@ private extern(C++) final class Semantic3Visitor : Visitor
                             // if a copy constructor is present, the return type conversion will be handled by it
                             const hasCopyCtor = exp.type.ty == Tstruct && (cast(TypeStruct)exp.type).sym.hasCopyCtor;
                             if (!hasCopyCtor || !exp.isLvalue())
-                                exp = exp.implicitCastTo(sc2, tret);
+                            {
+                                const errors = global.startGagging();
+                                auto implicitlyCastedExp = exp.implicitCastTo(sc2, tret);
+                                global.endGagging(errors);
+
+                                // <https://github.com/dlang/dmd/issues/20888>
+                                if (implicitlyCastedExp.isErrorExp())
+                                {
+                                    auto types = toAutoQualChars(exp.type, tret);
+                                    error(
+                                        exp.loc,
+                                        "return value `%s` of type `%s` does not match return type `%s`"
+                                        ~ ", and cannot be implicitly converted",
+                                        exp.toErrMsg(),
+                                        types[0],
+                                        types[1],
+                                    );
+
+                                    if (const func = exp.type.isFunction_Delegate_PtrToFunction())
+                                        if (func.next.equals(tret))
+                                            errorSupplemental(
+                                                exp.loc,
+                                                "Did you intend to call the %s?",
+                                                (exp.type.isPtrToFunction())
+                                                    ? "function pointer"
+                                                    : exp.type.kind
+                                            );
+                                }
+
+                                exp = implicitlyCastedExp;
+                            }
 
                             exp = exp.optimize(WANTvalue);
 
@@ -1375,7 +1405,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
             }
             if (isCppNonMappableType(f.next.toBasetype()))
             {
-                .error(funcdecl.loc, "%s `%s` cannot return type `%s` because its linkage is `extern(C++)`", funcdecl.kind, funcdecl.toPrettyChars, f.next.toChars());
+                .error(funcdecl.loc, "%s `%s` cannot return type `%s` because its linkage is `extern(C++)`", funcdecl.kind, funcdecl.toErrMsg(), f.next.toChars());
                 if (f.next.isTypeDArray())
                     errorSupplemental(funcdecl.loc, "slices are specific to D and do not have a counterpart representation in C++", f.next.toChars());
                 funcdecl.errors = true;
@@ -1384,7 +1414,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
             {
                 if (isCppNonMappableType(param.type.toBasetype(), param))
                 {
-                    .error(funcdecl.loc, "%s `%s` cannot have parameter of type `%s` because its linkage is `extern(C++)`", funcdecl.kind, funcdecl.toPrettyChars, param.type.toChars());
+                    .error(funcdecl.loc, "%s `%s` cannot have parameter of type `%s` because its linkage is `extern(C++)`", funcdecl.kind, funcdecl.toErrMsg(), param.type.toChars());
                     if (param.type.toBasetype().isTypeSArray())
                         errorSupplemental(funcdecl.loc, "perhaps use a `%s*` type instead",
                                           param.type.nextOf().mutableOf().unSharedOf().toChars());
@@ -1741,7 +1771,7 @@ extern (D) bool checkClosure(FuncDeclaration fd)
                     }
                     a.push(f);
                     .errorSupplemental(f.loc, "%s `%s` closes over variable `%s`",
-                        f.kind, f.toPrettyChars(), v.toChars());
+                        f.kind, f.toErrMsg(), v.toChars());
                     if (v.ident != Id.This)
                         .errorSupplemental(v.loc, "`%s` declared here", v.toChars());
 
index 84b9e4e65307ccdd6e4ab7b1a24bdaa0f1f9dc2c..659b0f4e0a50ab8e326a25309096f35e3f39fb4c 100644 (file)
@@ -20,6 +20,7 @@ import dmd.expressionsem;
 import dmd.func;
 import dmd.funcsem;
 import dmd.globals;
+import dmd.hdrgen;
 import dmd.id;
 import dmd.identifier;
 import dmd.init;
@@ -346,12 +347,13 @@ bool discardValue(Expression e)
         BinExp tmp = e.isBinExp();
         assert(tmp);
 
-        error(e.loc, "the result of the equality expression `%s` is discarded", e.toChars());
+        error(e.loc, "the result of the equality expression `%s` is discarded", e.toErrMsg());
         bool seenSideEffect = false;
         foreach(expr; [tmp.e1, tmp.e2])
         {
-            if (hasSideEffect(expr)) {
-                errorSupplemental(expr.loc, "note that `%s` may have a side effect", expr.toChars());
+            if (hasSideEffect(expr))
+            {
+                errorSupplemental(expr.loc, "note that `%s` may have a side effect", expr.toErrMsg());
                 seenSideEffect |= true;
             }
         }
@@ -359,7 +361,7 @@ bool discardValue(Expression e)
     default:
         break;
     }
-    error(e.loc, "`%s` has no effect", e.toChars());
+    error(e.loc, "`%s` has no effect", e.toErrMsg());
     return true;
 }
 
index 6a3bc38adce51d31e39818fce8c73e94a9b8b7c9..4029fdac38a37bf532dd37008b84de3525fdfca2 100644 (file)
@@ -664,7 +664,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
             const olderrors = global.startGagging();
             discardValue(fs.increment);
             if (global.endGagging(olderrors))
-                deprecation(fs.increment.loc, "`%s` has no effect", fs.increment.toChars());
+                deprecation(fs.increment.loc, "`%s` has no effect", fs.increment.toErrMsg());
             if (checkNonAssignmentArrayOp(fs.increment))
                 fs.increment = ErrorExp.get();
             fs.increment = fs.increment.optimize(WANTvalue);
@@ -2604,7 +2604,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
                     //errors = true;
                 }
                 if (global.endGagging(olderrors))
-                    deprecation(rs.exp.loc, "`%s` has no effect", rs.exp.toChars());
+                    deprecation(rs.exp.loc, "`%s` has no effect", rs.exp.toErrMsg());
 
                 /* Replace:
                  *      return exp;
index e82a582bee3269fb0d4cc39539eaaaf588f64c8a..aad88d6bcaba076062660b0ff28426a748a30bfc 100644 (file)
@@ -436,8 +436,10 @@ enum FirstCKeyword = TOK.inline;
 // Assert that all token enum members have consecutive values and
 // that none of them overlap
 static assert(() {
-    foreach (idx, enumName; __traits(allMembers, TOK)) {
-       static if (idx != __traits(getMember, TOK, enumName)) {
+    foreach (idx, enumName; __traits(allMembers, TOK))
+    {
+       static if (idx != __traits(getMember, TOK, enumName))
+       {
            pragma(msg, "Error: Expected TOK.", enumName, " to be ", idx, " but is ", __traits(getMember, TOK, enumName));
            static assert(0);
        }
@@ -925,13 +927,18 @@ nothrow:
         return 0;
     }
 
-    extern(D) void appendInterpolatedPart(const ref OutBuffer buf) {
+    extern(D) void appendInterpolatedPart(const ref OutBuffer buf)
+    {
         appendInterpolatedPart(cast(const(char)*)buf[].ptr, buf.length);
     }
-    extern(D) void appendInterpolatedPart(const(char)[] str) {
+
+    extern(D) void appendInterpolatedPart(const(char)[] str)
+    {
         appendInterpolatedPart(str.ptr, str.length);
     }
-    extern(D) void appendInterpolatedPart(const(char)* ptr, size_t length) {
+
+    extern(D) void appendInterpolatedPart(const(char)* ptr, size_t length)
+    {
         assert(value == TOK.interpolated);
         if (interpolatedSet is null)
             interpolatedSet = new InterpolatedSet;
index ae52de554dc491540e2186434c572f37b773cfe7..7f87ac4d731bee22c2d6ef9c153b91aa39b4116d 100644 (file)
@@ -1187,7 +1187,7 @@ private const(char)* getParamError(TypeFunction tf, Expression arg, Parameter pa
     // only mention rvalue if it's relevant
     const rv = !arg.isLvalue() && par.isReference();
     buf.printf("cannot pass %sargument `%s` of type `%s` to parameter `%s`",
-        rv ? "rvalue ".ptr : "".ptr, arg.toChars(), at,
+        rv ? "rvalue ".ptr : "".ptr, arg.toErrMsg(), at,
         parameterToChars(par, tf, qual));
     return buf.extractChars();
 }
@@ -2329,7 +2329,7 @@ Type typeSemantic(Type type, Loc loc, Scope* sc)
             {
                 const(char)* errTxt = fparam.storageClass & STC.ref_ ? "ref" : "out";
                 .error(e.loc, "expression `%s` of type `%s` is not implicitly convertible to type `%s %s` of parameter `%s`",
-                      e.toChars(), e.type.toChars(), errTxt, fparam.type.toChars(), fparam.toChars());
+                      e.toErrMsg(), e.type.toChars(), errTxt, fparam.type.toChars(), fparam.toChars());
             }
             e = e.implicitCastTo(sc, fparam.type);
 
@@ -2493,10 +2493,17 @@ Type typeSemantic(Type type, Loc loc, Scope* sc)
                     errors = true;
                 }
 
-                const bool isTypesafeVariadic = i + 1 == dim &&
-                                                tf.parameterList.varargs == VarArg.typesafe &&
-                                                (t.isTypeDArray() || t.isTypeClass());
-                if (isTypesafeVariadic)
+                const bool isTypesafeVariadic = i + 1 == dim && tf.parameterList.varargs == VarArg.typesafe;
+                const bool isStackAllocatedVariadic = isTypesafeVariadic && (t.isTypeDArray() || t.isTypeClass());
+
+                if (isTypesafeVariadic && t.isTypeClass())
+                {
+                    // Deprecated in 2.111, kept as a legacy feature for compatibility (currently no plan to turn it into an error)
+                    .deprecation(loc, "typesafe variadic parameters with a `class` type (`%s %s...`) are deprecated",
+                        t.isTypeClass().sym.ident.toChars(), fparam.toChars());
+                }
+
+                if (isStackAllocatedVariadic)
                 {
                     /* typesafe variadic arguments are constructed on the stack, so must be `scope`
                      */
@@ -2518,7 +2525,7 @@ Type typeSemantic(Type type, Loc loc, Scope* sc)
                         }
                     }
 
-                    if (isTypesafeVariadic)
+                    if (isStackAllocatedVariadic)
                     {
                         /* This is because they can be constructed on the stack
                          * https://dlang.org/spec/function.html#typesafe_variadic_functions
@@ -3454,10 +3461,26 @@ Expression getProperty(Type t, Scope* scope_, Loc loc, Identifier ident, int fla
             {
                 if (auto sym = dsym.isAggregateDeclaration())
                 {
-                    if (auto fd = search_function(sym, Id.opDispatch))
-                        errorSupplemental(loc, "potentially malformed `opDispatch`. Use an explicit instantiation to get a better error message");
-                    else if (!sym.members)
+                    if (!sym.members)
+                    {
                         errorSupplemental(sym.loc, "`%s %s` is opaque and has no members.", sym.kind, mt.toPrettyChars(true));
+                        return ErrorExp.get();
+                    }
+
+                    if (auto fd = search_function(sym, Id.opDispatch))
+                    {
+                        if (auto td = fd.isTemplateDeclaration())
+                        {
+                            e = mt.defaultInitLiteral(loc);
+                            auto se = new StringExp(e.loc, ident.toString());
+                            auto tiargs = new Objects();
+                            tiargs.push(se);
+                            auto dti = new DotTemplateInstanceExp(e.loc, e, Id.opDispatch, tiargs);
+                            dti.ti.tempdecl = td;
+                            dti.dotTemplateSemanticProp(scope_, DotExpFlag.none);
+                            return ErrorExp.get();
+                        }
+                    }
                 }
                 errorSupplemental(dsym.loc, "%s `%s` defined here",
                     dsym.kind, dsym.toChars());
@@ -4731,7 +4754,7 @@ Expression dotExp(Type mt, Scope* sc, Expression e, Identifier ident, DotExpFlag
         {
             if (e.op == EXP.type)
             {
-                error(e.loc, "`%s` is not an expression", e.toChars());
+                error(e.loc, "`%s` is not an expression", e.toErrMsg());
                 return ErrorExp.get();
             }
             else if (mt.dim.toUInteger() < 1 && checkUnsafeDotExp(sc, e, ident, flag))
@@ -4780,7 +4803,7 @@ Expression dotExp(Type mt, Scope* sc, Expression e, Identifier ident, DotExpFlag
         }
         if (e.op == EXP.type && (ident == Id.length || ident == Id.ptr))
         {
-            error(e.loc, "`%s` is not an expression", e.toChars());
+            error(e.loc, "`%s` is not an expression", e.toErrMsg());
             return ErrorExp.get();
         }
         if (ident == Id.length)
@@ -5207,7 +5230,7 @@ Expression dotExp(Type mt, Scope* sc, Expression e, Identifier ident, DotExpFlag
         Declaration d = s.isDeclaration();
         if (!d)
         {
-            error(e.loc, "`%s.%s` is not a declaration", e.toChars(), ident.toChars());
+            error(e.loc, "`%s.%s` is not a declaration", e.toErrMsg(), ident.toChars());
             return ErrorExp.get();
         }
 
@@ -5640,7 +5663,7 @@ Expression dotExp(Type mt, Scope* sc, Expression e, Identifier ident, DotExpFlag
         Declaration d = s.isDeclaration();
         if (!d)
         {
-            error(e.loc, "`%s.%s` is not a declaration", e.toChars(), ident.toChars());
+            error(e.loc, "`%s.%s` is not a declaration", e.toErrMsg(), ident.toChars());
             return ErrorExp.get();
         }
 
@@ -6715,30 +6738,32 @@ Type pointerTo(Type type)
 {
     if (type.ty == Terror)
         return type;
-    if (!type.pto)
+    auto mcache = type.getMcache();
+    if (!mcache.pto)
     {
         Type t = new TypePointer(type);
         if (type.ty == Tfunction)
         {
             t.deco = t.merge().deco;
-            type.pto = t;
+            mcache.pto = t;
         }
         else
-            type.pto = t.merge();
+            mcache.pto = t.merge();
     }
-    return type.pto;
+    return mcache.pto;
 }
 
 Type referenceTo(Type type)
 {
     if (type.ty == Terror)
         return type;
-    if (!type.rto)
+    auto mcache = type.getMcache();
+    if (!mcache.rto)
     {
         Type t = new TypeReference(type);
-        type.rto = t.merge();
+        mcache.rto = t.merge();
     }
-    return type.rto;
+    return mcache.rto;
 }
 
 // Make corresponding static array type without semantic
@@ -6756,12 +6781,13 @@ Type arrayOf(Type type)
 {
     if (type.ty == Terror)
         return type;
-    if (!type.arrayof)
+    auto mcache = type.getMcache();
+    if (!mcache.arrayof)
     {
         Type t = new TypeDArray(type);
-        type.arrayof = t.merge();
+        mcache.arrayof = t.merge();
     }
-    return type.arrayof;
+    return mcache.arrayof;
 }
 
 /********************************
@@ -7013,6 +7039,39 @@ Type sharedWildConstOf(Type type)
     return t;
 }
 
+Type nakedOf(Type type)
+{
+    //printf("Type::nakedOf() %p, %s\n", type, type.toChars());
+    if (type.mod == 0)
+        return type;
+    if (type.mcache) with(type.mcache)
+    {
+        // the cache has the naked type at the "identity" position, try to find it
+        if (cto && cto.mod == 0)
+            return cto;
+        if (ito && ito.mod == 0)
+            return ito;
+        if (sto && sto.mod == 0)
+            return sto;
+        if (scto && scto.mod == 0)
+            return scto;
+        if (wto && wto.mod == 0)
+            return wto;
+        if (wcto && wcto.mod == 0)
+            return wcto;
+        if (swto && swto.mod == 0)
+            return swto;
+        if (swcto && swcto.mod == 0)
+            return swcto;
+    }
+    Type t = type.nullAttributes();
+    t.mod = 0;
+    t = t.merge();
+    t.fixTo(type);
+    //printf("\t%p %s\n", t, t.toChars());
+    return t;
+}
+
 Type unqualify(Type type, uint m)
 {
     Type t = type.mutableOf().unSharedOf();
index 58102cda36f7260f1d8fe067abf9c6a93c98e1b6..1a96823dadc94dd143b529ad4c404f38827a46b9 100644 (file)
@@ -22,6 +22,7 @@ import dmd.expression;
 import dmd.globals;
 import dmd.location;
 import dmd.mtype;
+import dmd.typesem;
 import core.stdc.stdio;
 
 /****************************************************
@@ -67,6 +68,9 @@ bool genTypeInfo(Expression e, Loc loc, Type torig, Scope* sc)
 
     import dmd.typesem : merge2;
     Type t = torig.merge2(); // do this since not all Type's are merge'd
+    if (t.ty == Taarray)
+        t = makeNakedAssociativeArray(cast(TypeAArray)t);
+
     bool needsCodegen = false;
     if (!t.vtinfo)
     {
@@ -79,7 +83,7 @@ bool genTypeInfo(Expression e, Loc loc, Type torig, Scope* sc)
         else if (t.isWild())
             t.vtinfo = TypeInfoWildDeclaration.create(t);
         else
-            t.vtinfo = getTypeInfoDeclaration(t);
+            t.vtinfo = getTypeInfoDeclaration(t, sc);
         assert(t.vtinfo);
 
         // ClassInfos are generated as part of ClassDeclaration codegen
@@ -105,7 +109,7 @@ bool genTypeInfo(Expression e, Loc loc, Type torig, Scope* sc)
  */
 extern (C++) Type getTypeInfoType(Loc loc, Type t, Scope* sc);
 
-private TypeInfoDeclaration getTypeInfoDeclaration(Type t)
+private TypeInfoDeclaration getTypeInfoDeclaration(Type t, Scope* sc)
 {
     //printf("Type::getTypeInfoDeclaration() %s\n", t.toChars());
     switch (t.ty)
@@ -117,7 +121,7 @@ private TypeInfoDeclaration getTypeInfoDeclaration(Type t)
     case Tsarray:
         return TypeInfoStaticArrayDeclaration.create(t);
     case Taarray:
-        return TypeInfoAssociativeArrayDeclaration.create(t);
+        return getTypeInfoAssocArrayDeclaration(cast(TypeAArray)t, sc);
     case Tstruct:
         return TypeInfoStructDeclaration.create(t);
     case Tvector:
@@ -141,6 +145,70 @@ private TypeInfoDeclaration getTypeInfoDeclaration(Type t)
     }
 }
 
+/******************************************
+ * Instantiate TypeInfoAssociativeArrayDeclaration and fill
+ * the entry with TypeInfo_AssociativeArray.Entry!(t.index, t.next)
+ *
+ * Params:
+ *      t = TypeAArray to generate TypeInfo_AssociativeArray for
+ *      sc = context
+ * Returns:
+ *      a TypeInfoAssociativeArrayDeclaration with field entry initialized
+ */
+TypeInfoDeclaration getTypeInfoAssocArrayDeclaration(TypeAArray t, Scope* sc)
+{
+    import dmd.arraytypes;
+    import dmd.expressionsem;
+    import dmd.id;
+
+    assert(sc); // must not be called in the code generation phase
+
+    auto ti = TypeInfoAssociativeArrayDeclaration.create(t);
+    t.vtinfo = ti; // assign it early to avoid recursion in expressionSemantic
+    Loc loc = t.loc;
+    auto tiargs = new Objects();
+    tiargs.push(t.index); // always called with naked types
+    tiargs.push(t.next);
+
+    Expression id = new IdentifierExp(loc, Id.empty);
+    id = new DotIdExp(loc, id, Id.object);
+    id = new DotIdExp(loc, id, Id.TypeInfo_AssociativeArray);
+    auto tempinst = new DotTemplateInstanceExp(loc, id, Id.Entry, tiargs);
+    auto e = expressionSemantic(tempinst, sc);
+    assert(e.type);
+    ti.entry = e.type;
+    if (auto ts = ti.entry.isTypeStruct())
+    {
+        ts.sym.requestTypeInfo = true;
+        if (auto tmpl = ts.sym.isInstantiated())
+            tmpl.minst = sc._module.importedFrom; // ensure it get's emitted
+    }
+    getTypeInfoType(loc, ti.entry, sc);
+    assert(ti.entry.vtinfo);
+
+    return ti;
+}
+
+/******************************************
+ * Find or create a TypeAArray with index and next without
+ * any head modifiers, tail `inout` is replaced with `const`
+ *
+ * Params:
+ *      t = TypeAArray to convert
+ * Returns:
+ *      t = found type
+ */
+Type makeNakedAssociativeArray(TypeAArray t)
+{
+    Type tindex = t.index.toBasetype().nakedOf().substWildTo(MODFlags.const_);
+    Type tnext = t.next.toBasetype().nakedOf().substWildTo(MODFlags.const_);
+    if (tindex == t.index && tnext == t.next)
+        return t;
+
+    t = new TypeAArray(tnext, tindex);
+    return t.merge();
+}
+
 /**************************************************
  * Returns:
  *      true if any part of type t is speculative.
index 4a8c94275249f33ed87c73955c9c4b0a82fa4c42..e41619191129cd5dd4ca34acc1f95eed5ab376e9 100644 (file)
@@ -14,6 +14,8 @@
 
 class Expression;
 class Type;
+class TypeAArray;
+class TypeInfoDeclaration;
 struct Scope;
 
 namespace dmd
@@ -21,5 +23,7 @@ namespace dmd
     bool genTypeInfo(Expression *e, Loc loc, Type *torig, Scope *sc);
     bool isSpeculativeType(Type *t);
     bool builtinTypeInfo(Type *t);
+    Type *makeNakedAssociativeArray(TypeAArray *t);
+    TypeInfoDeclaration *getTypeInfoAssocArrayDeclaration(TypeAArray *t, Scope *sc);
 }
 Type *getTypeInfoType(Loc loc, Type *t, Scope *sc);
index f548451c8ba52a83b3e353e5bb6b73fea25d5952..e81b2f0157fa69d4b6ea345cc67f75b63b341b2c 100644 (file)
@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "dmd/scope.h"
 #include "dmd/template.h"
 #include "dmd/target.h"
+#include "dmd/typinf.h"
 
 #include "tree.h"
 #include "fold-const.h"
@@ -728,7 +729,8 @@ public:
        void **__vptr;
        void *__monitor;
        TypeInfo value;
-       TypeInfo key;  */
+       TypeInfo key;
+       TypeInfo entry;  */
 
   void visit (TypeInfoAssociativeArrayDeclaration *d) final override
   {
@@ -742,6 +744,12 @@ public:
 
     /* TypeInfo for index of type.  */
     this->layout_field (build_typeinfo (d->loc, ti->index));
+
+    /* TypeInfo for the key/value pair.  */
+    if (d->entry != NULL)
+      this->layout_field (build_typeinfo (d->loc, d->entry));
+    else
+      this->layout_field (null_pointer_node);
   }
 
   /* Layout of TypeInfo_Vector is:
@@ -1550,7 +1558,7 @@ get_cpp_typeinfo_decl (ClassDeclaration *decl)
 /* Get the exact TypeInfo for TYPE, if it doesn't exist, create it.  */
 
 void
-create_typeinfo (Type *type, Module *mod)
+create_typeinfo (Type *type, Scope *sc)
 {
   if (!Type::dtypeinfo)
     create_frontend_tinfo_types ();
@@ -1559,6 +1567,9 @@ create_typeinfo (Type *type, Module *mod)
   Type *t = dmd::merge2 (type);
   Identifier *ident;
 
+  if (TypeAArray *ta = t->isTypeAArray ())
+    t = dmd::makeNakedAssociativeArray (ta);
+
   if (!t->vtinfo)
     {
       tinfo_kind tk = get_typeinfo_kind (t);
@@ -1636,9 +1647,11 @@ create_typeinfo (Type *type, Module *mod)
            {
              ident = Identifier::idPool ("TypeInfo_AssociativeArray");
              make_internal_typeinfo (tk, ident, ptr_type_node, ptr_type_node,
-                                     NULL);
+                                     ptr_type_node, NULL);
            }
-         t->vtinfo = TypeInfoAssociativeArrayDeclaration::create (t);
+         t->vtinfo = sc && have_typeinfo_p (Type::typeinfoassociativearray)
+           ? dmd::getTypeInfoAssocArrayDeclaration (t->isTypeAArray (), sc)
+           : TypeInfoAssociativeArrayDeclaration::create (t);
          break;
 
        case TK_STRUCT_TYPE:
@@ -1711,6 +1724,7 @@ create_typeinfo (Type *type, Module *mod)
       if (!builtin_typeinfo_p (t))
        {
          /* Find module that will go all the way to an object file.  */
+         Module *mod = sc ? sc->_module->importedFrom : NULL;
          if (mod)
            mod->members->push (t->vtinfo);
          else
@@ -1724,113 +1738,4 @@ create_typeinfo (Type *type, Module *mod)
   gcc_assert (type->vtinfo != NULL);
 }
 
-/* Implements a visitor interface to check whether a type is speculative.
-   TypeInfo_Struct would reference the members of the struct it is representing
-   (e.g: opEquals via xopEquals field), so if it's instantiated in speculative
-   context, TypeInfo creation should also be stopped to avoid possible
-   `unresolved symbol' linker errors.  */
-
-class SpeculativeTypeVisitor : public Visitor
-{
-  using Visitor::visit;
-
-  bool result_;
-
-public:
-  SpeculativeTypeVisitor (void)
-  {
-    this->result_ = false;
-  }
-
-  bool result (void)
-  {
-    return this->result_;
-  }
-
-  void visit (Type *t) final override
-  {
-    Type *tb = t->toBasetype ();
-    if (tb != t)
-      tb->accept (this);
-  }
-
-  void visit (TypeNext *t) final override
-  {
-    if (t->next)
-      t->next->accept (this);
-  }
-
-  void visit (TypeBasic *) final override
-  {
-  }
-
-  void visit (TypeVector *t) final override
-  {
-    t->basetype->accept (this);
-  }
-
-  void visit (TypeAArray *t) final override
-  {
-    t->index->accept (this);
-    visit ((TypeNext *) t);
-  }
-
-  void visit (TypeFunction *t) final override
-  {
-    visit ((TypeNext *) t);
-  }
-
-  void visit (TypeStruct *t) final override
-  {
-    StructDeclaration *sd = t->sym;
-    if (TemplateInstance *ti = sd->isInstantiated ())
-      {
-       if (!ti->needsCodegen ())
-         {
-           if (ti->minst || sd->requestTypeInfo ())
-             return;
-
-           this->result_ |= true;
-         }
-      }
-  }
-
-  void visit (TypeClass *t) final override
-  {
-    ClassDeclaration *cd = t->sym;
-    if (TemplateInstance *ti = cd->isInstantiated ())
-      {
-       if (!ti->needsCodegen () && !ti->minst)
-         {
-           this->result_ |= true;
-         }
-      }
-  }
-
-  void visit (TypeTuple *t) final override
-  {
-    if (!t->arguments)
-      return;
-
-    for (size_t i = 0; i < t->arguments->length; i++)
-      {
-       Type *tprm = (*t->arguments)[i]->type;
-       if (tprm)
-         tprm->accept (this);
-       if (this->result_)
-         return;
-      }
-  }
-};
-
-/* Return true if type was instantiated in a speculative context.  */
-
-bool
-speculative_type_p (Type *t)
-{
-  SpeculativeTypeVisitor v = SpeculativeTypeVisitor ();
-  t->accept (&v);
-  return v.result ();
-}
-
 #include "gt-d-typeinfo.h"
index bb83c299cedce83cee34e04b8d3b059cbfa5695a..3861a37899cc5b18062ada0393d0bd69ea3c46e1 100644 (file)
@@ -5,7 +5,7 @@ module object;
 
 extern(C) int main()
 {
-    int[int] aa;
+    int[int] aa; // { dg-error ".object.TypeInfo. could not be found" }
     aa[0] = 1;  // { dg-error ".object.TypeInfo. could not be found, but is implicitly used" }
     return 0;
 }
index 18d1f3604d5adca04c2df0b68cf8c304ba71d46d..2a3cfee33722c390f6b122f176c524c631abdcfd 100644 (file)
@@ -2,8 +2,8 @@
 TEST_OUTPUT:
 ---
 fail_compilation/attributediagnostic.d(21): Error: `@safe` function `attributediagnostic.layer2` cannot call `@system` function `attributediagnostic.layer1`
-fail_compilation/attributediagnostic.d(23):        which calls `attributediagnostic.layer0`
-fail_compilation/attributediagnostic.d(25):        which calls `attributediagnostic.system`
+fail_compilation/attributediagnostic.d(23):        which calls `layer0`
+fail_compilation/attributediagnostic.d(25):        which calls `system`
 fail_compilation/attributediagnostic.d(27):        and executing an `asm` statement without `@trusted` annotation makes it fail to infer `@safe`
 fail_compilation/attributediagnostic.d(22):        `attributediagnostic.layer1` is declared here
 fail_compilation/attributediagnostic.d(43): Error: `@safe` function `D main` cannot call `@system` function `attributediagnostic.system1`
index 9069ecc4788ded93f7b541d975dc78a069ea9d19..f54a4e91d941c080d7bd9d9517c3c7f90bb7c828 100644 (file)
@@ -2,8 +2,8 @@
 TEST_OUTPUT:
 ---
 fail_compilation/attributediagnostic_nogc.d(21): Error: `@nogc` function `attributediagnostic_nogc.layer2` cannot call non-@nogc function `attributediagnostic_nogc.layer1`
-fail_compilation/attributediagnostic_nogc.d(22):        which calls `attributediagnostic_nogc.layer0`
-fail_compilation/attributediagnostic_nogc.d(23):        which calls `attributediagnostic_nogc.gc`
+fail_compilation/attributediagnostic_nogc.d(22):        which calls `layer0`
+fail_compilation/attributediagnostic_nogc.d(23):        which calls `gc`
 fail_compilation/attributediagnostic_nogc.d(27):        and executing an `asm` statement without `@nogc` annotation makes it fail to infer `@nogc`
 fail_compilation/attributediagnostic_nogc.d(43): Error: `@nogc` function `D main` cannot call non-@nogc function `attributediagnostic_nogc.gc1`
 fail_compilation/attributediagnostic_nogc.d(32):        and allocating with `new` makes it fail to infer `@nogc`
index add5ccc05a67765845c2878efd5b373188ba872b..3b5c17a0aa5e62bee518c8c6dc2552efe9836d5f 100644 (file)
@@ -2,8 +2,8 @@
 TEST_OUTPUT:
 ---
 fail_compilation/attributediagnostic_nothrow.d(19): Error: function `attributediagnostic_nothrow.layer1` is not `nothrow`
-fail_compilation/attributediagnostic_nothrow.d(20):        which calls `attributediagnostic_nothrow.layer0`
-fail_compilation/attributediagnostic_nothrow.d(21):        which calls `attributediagnostic_nothrow.gc`
+fail_compilation/attributediagnostic_nothrow.d(20):        which calls `layer0`
+fail_compilation/attributediagnostic_nothrow.d(21):        which calls `gc`
 fail_compilation/attributediagnostic_nothrow.d(25):        and executing an `asm` statement without a `nothrow` annotation makes it fail to infer `nothrow`
 fail_compilation/attributediagnostic_nothrow.d(19): Error: function `attributediagnostic_nothrow.layer2` may throw but is marked as `nothrow`
 fail_compilation/attributediagnostic_nothrow.d(41): Error: function `attributediagnostic_nothrow.gc1` is not `nothrow`
index 3b2a5e0f2243194e712d65046df30df07b649421..5ab491faeaa298c10cacf3716d09af95a9364df5 100644 (file)
@@ -3,7 +3,7 @@ TEST_OUTPUT:
 ----
 fail_compilation/b19523.d(13): Error: undefined identifier `SomeStruct`
 fail_compilation/b19523.d(14): Error: function `foo` is not callable using argument types `(_error_)`
-fail_compilation/b19523.d(14):        cannot pass argument `__lambda_L14_C6` of type `_error_` to parameter `int delegate() arg`
+fail_compilation/b19523.d(14):        cannot pass argument `__error` of type `_error_` to parameter `int delegate() arg`
 fail_compilation/b19523.d(19):        `b19523.foo(int delegate() arg)` declared here
 ----
 */
index 574b29aae38c76d7fd31271890d3a6c475098b28..157a07584e1a804cc1e0c4769b75e4df6d622e27 100644 (file)
@@ -65,7 +65,7 @@ TEST_OUTPUT:
 fail_compilation/bug9631.d(80): Error: function `f` is not callable using argument types `(int, S)`
 fail_compilation/bug9631.d(80):        cannot pass argument `y` of type `bug9631.tem!().S` to parameter `bug9631.S s`
 fail_compilation/bug9631.d(79):        `bug9631.arg.f(int i, S s)` declared here
-fail_compilation/bug9631.d(81): Error: function literal `__lambda_L81_C5(S s)` is not callable using argument types `(S)`
+fail_compilation/bug9631.d(81): Error: function literal `(S s) { }` is not callable using argument types `(S)`
 fail_compilation/bug9631.d(81):        cannot pass argument `x` of type `bug9631.S` to parameter `bug9631.tem!().S s`
 fail_compilation/bug9631.d(87): Error: constructor `bug9631.arg.A.this(S __param_0)` is not callable using argument types `(S)`
 fail_compilation/bug9631.d(87):        cannot pass argument `S(0)` of type `bug9631.tem!().S` to parameter `bug9631.S __param_0`
diff --git a/gcc/testsuite/gdc.test/fail_compilation/code_global_scope.d b/gcc/testsuite/gdc.test/fail_compilation/code_global_scope.d
new file mode 100644 (file)
index 0000000..4db84c0
--- /dev/null
@@ -0,0 +1,26 @@
+/**
+TEST_OUTPUT:
+---
+fail_compilation/code_global_scope.d(18): Error: `switch` statement must be inside function scope
+fail_compilation/code_global_scope.d(19): Error: `do` statement must be inside function scope
+fail_compilation/code_global_scope.d(20): Error: `foreach` statement must be inside function scope
+fail_compilation/code_global_scope.d(21): Error: `while` statement must be inside function scope
+fail_compilation/code_global_scope.d(22): Error: `if` statement must be inside function scope
+fail_compilation/code_global_scope.d(23): Error: `return` statement must be inside function scope
+fail_compilation/code_global_scope.d(24): Error: `goto` statement must be inside function scope
+fail_compilation/code_global_scope.d(25): Error: `continue` statement must be inside function scope
+fail_compilation/code_global_scope.d(26): Error: `break` statement must be inside function scope
+---
+*/
+
+
+
+switch s;
+do d;
+foreach (i; 0 .. 4) {}
+while (x) {}
+if (y) {}
+return 0;
+goto A;
+continue B;
+break;
index b3a335b4e242e0ec6bec0715fcfdca7e8de65f1f..2a9aff6dcd4260c502243f73277945bc3751a160 100644 (file)
@@ -5,7 +5,7 @@ TEST_OUTPUT:
 fail_compilation/constraints_defs.d(49): Error: template instance `constraints_defs.main.def!(int, 0, (a) => a)` does not match template declaration `def(T, int i = 5, alias R)()`
   with `T = int,
        i = 0,
-       R = __lambda_L49_C18`
+       R = (a) => a`
   must satisfy the following constraint:
 `       N!T`
 fail_compilation/constraints_defs.d(50): Error: template instance `imports.constraints.defa!int` does not match template declaration `defa(T, U = int)()`
index fee7a3e3e7b1ad425714cc7959d28a5366578ee4..1c4b97a99f800bee5e37da0c7825b8060df1b024 100644 (file)
@@ -22,7 +22,7 @@ fail_compilation/constraints_tmpl.d(41): Error: template instance `imports.const
 `       N!T
        N!U`
 fail_compilation/constraints_tmpl.d(43): Error: template instance `constraints_tmpl.main.lambda!((a) => a)` does not match template declaration `lambda(alias pred)()`
-  with `pred = __lambda_L43_C13`
+  with `pred = (a) => a`
   must satisfy the following constraint:
 `       N!int`
 ---
index b3c89b46d2aca72c2b6c10c08f97c5ad2b69d701..479e6e924d79a47e2bed6295168fc178691c3e8f 100644 (file)
@@ -1,10 +1,10 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/cppmangle.d(11): Error: expected valid identifier for C++ namespace but got ``
-fail_compilation/cppmangle.d(15): Error: expected valid identifier for C++ namespace but got `0num`
+fail_compilation/cppmangle.d(11): Error: expected valid identifier for C++ namespace but got `""`
+fail_compilation/cppmangle.d(15): Error: expected valid identifier for C++ namespace but got `"0num"`
 fail_compilation/cppmangle.d(19): Error: compile time string constant (or sequence) expected, not `2`
-fail_compilation/cppmangle.d(23): Error: expected valid identifier for C++ namespace but got `invalid@namespace`
+fail_compilation/cppmangle.d(23): Error: expected valid identifier for C++ namespace but got `"invalid@namespace"`
 ---
 */
 
index 213b54d10f56a797659223a42e5f94bbd1d58031..f336e35d69c570ea8fce645e1ec408a3037e5119 100644 (file)
@@ -9,7 +9,7 @@ fail_compilation/cppvar.d(21): Error: variable `cppvar.staticVar` cannot have `e
 fail_compilation/cppvar.d(21):        perhaps declare it as `__gshared` instead
 fail_compilation/cppvar.d(22): Error: variable `cppvar.sharedVar` cannot have `extern(C++)` linkage because it is `shared`
 fail_compilation/cppvar.d(22):        perhaps declare it as `__gshared` instead
-fail_compilation/cppvar.d(30): Error: delegate `cppvar.__lambda_L30_C46` cannot return type `bool[3]` because its linkage is `extern(C++)`
+fail_compilation/cppvar.d(30): Error: delegate `() { bool[3] a = false; return a; }` cannot return type `bool[3]` because its linkage is `extern(C++)`
 ---
 */
 #line 10
index 0ed04d3a7495f1ab40e9bd43b25a96b21a5fdf34..3a24180af8c025f0fd854541c7f86446c45863ab 100644 (file)
@@ -2,12 +2,12 @@
 TEST_OUTPUT:
 ---
 fail_compilation/diag12829.d(15): Error: function `diag12829.test1` is `@nogc` yet allocates closure for `test1()` with the GC
-fail_compilation/diag12829.d(18):        delegate `diag12829.test1.__lambda_L18_C33` closes over variable `x`
+fail_compilation/diag12829.d(18):        delegate `() { int y = x; }` closes over variable `x`
 fail_compilation/diag12829.d(17):        `x` declared here
-fail_compilation/diag12829.d(22):        function `diag12829.test1.bar` closes over variable `x`
+fail_compilation/diag12829.d(22):        function `bar` closes over variable `x`
 fail_compilation/diag12829.d(17):        `x` declared here
 fail_compilation/diag12829.d(29): Error: function `diag12829.test2` is `@nogc` yet allocates closure for `test2()` with the GC
-fail_compilation/diag12829.d(34):        function `diag12829.test2.S.foo` closes over variable `x`
+fail_compilation/diag12829.d(34):        function `foo` closes over variable `x`
 fail_compilation/diag12829.d(31):        `x` declared here
 ---
 */
index fee73078e30115fedc466cdeaf8d7443dddf18cc..b2044b31db3308acfa1fabc88332c17018700847 100644 (file)
@@ -1,11 +1,9 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/diag14145.d(16): Error: no property `i` for `_` of type `diag14145.main.Capture!(i)`
-fail_compilation/diag14145.d(16):        potentially malformed `opDispatch`. Use an explicit instantiation to get a better error message
-fail_compilation/diag14145.d(26):        struct `Capture` defined here
-fail_compilation/diag14145.d(35): Error: expression `*this.ptr` of type `shared(int)` is not implicitly convertible to return type `ref int`
-fail_compilation/diag14145.d(17): Error: template instance `diag14145.main.Capture!(i).Capture.opDispatch!"i"` error instantiating
+fail_compilation/diag14145.d(14): Error: no property `i` for `_` of type `diag14145.main.Capture!(i)`
+fail_compilation/diag14145.d(33): Error: expression `*this.ptr` of type `shared(int)` is not implicitly convertible to return type `ref int`
+fail_compilation/diag14145.d(14): Error: template instance `diag14145.main.Capture!(i).Capture.opDispatch!"i"` error instantiating
 ---
 */
 
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag20888.d b/gcc/testsuite/gdc.test/fail_compilation/diag20888.d
new file mode 100644 (file)
index 0000000..84af425
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/diag20888.d(24): Error: return value `callback` of type `int function()` does not match return type `int`, and cannot be implicitly converted
+fail_compilation/diag20888.d(24):        Did you intend to call the function pointer?
+fail_compilation/diag20888.d(29): Error: return value `s` of type `string` does not match return type `int`, and cannot be implicitly converted
+fail_compilation/diag20888.d(34): Error: return value `callback` of type `int delegate()` does not match return type `int`, and cannot be implicitly converted
+fail_compilation/diag20888.d(34):        Did you intend to call the delegate?
+fail_compilation/diag20888.d(39): Error: return value `callback` of type `int delegate()` does not match return type `int`, and cannot be implicitly converted
+fail_compilation/diag20888.d(39):        Did you intend to call the delegate?
+fail_compilation/diag20888.d(44): Error: return value `callback` of type `int delegate()*` does not match return type `int`, and cannot be implicitly converted
+fail_compilation/diag20888.d(49): Error: return value `callback` of type `int delegate()` does not match return type `string`, and cannot be implicitly converted
+fail_compilation/diag20888.d(54): Error: return value `() => 3755` of type `int function() pure nothrow @nogc @safe` does not match return type `int`, and cannot be implicitly converted
+fail_compilation/diag20888.d(54):        Did you intend to call the function pointer?
+fail_compilation/diag20888.d(59): Error: `return` expression expected
+fail_compilation/diag20888.d(64): Error: cannot return non-void from `void` function
+fail_compilation/diag20888.d(70): Error: return value `() => i` of type `int delegate() pure nothrow @nogc @safe` does not match return type `int`, and cannot be implicitly converted
+fail_compilation/diag20888.d(70):        Did you intend to call the delegate?
+---
+*/
+
+int alpha(int function() callback)
+{
+       return callback;
+}
+
+int beta(string s)
+{
+       return s;
+}
+
+int gamma(int delegate() callback)
+{
+       return callback;
+}
+
+int delta(int delegate() callback)
+{
+       return callback;
+}
+
+int epsilon(int delegate()* callback)
+{
+       return callback; // no supplemental yet
+}
+
+string zeta(int delegate() callback)
+{
+       return callback;
+}
+
+int eta()
+{
+       return () => 0xEAB;
+}
+
+int theta()
+{
+       return;
+}
+
+void iota()
+{
+       return 0xEAB;
+}
+
+int kappa()
+{
+       int i = 0xEAB;
+       return () { return i; };
+}
index 0173d4b78eff7dd88f1953e754cf8761c9692f52..4009beadcfdb6dd61c5aeb2052494ea1e38c29b6 100644 (file)
@@ -1,19 +1,19 @@
 /**
 TEST_OUTPUT:
 ---
-fail_compilation/diag_funclit.d(103): Error: function literal `__lambda_L103_C5(x, y, z)` is not callable using argument types `()`
+fail_compilation/diag_funclit.d(103): Error: function literal `(x, y, z) { return 42; }` is not callable using argument types `()`
 fail_compilation/diag_funclit.d(103):        too few arguments, expected 3, got 0
-fail_compilation/diag_funclit.d(106): Error: function literal `__lambda_L106_C5(x, y, z)` is not callable using argument types `(int, string, int, int)`
+fail_compilation/diag_funclit.d(106): Error: `(x, y, z) { return 42; }` is not callable using argument types `(int, string, int, int)`
 fail_compilation/diag_funclit.d(106):        too many arguments, expected 3, got 4
-fail_compilation/diag_funclit.d(108): Error: function literal `__lambda_L108_C5(x, y, string z = "Hello")` is not callable using argument types `(int, int, string, string)`
+fail_compilation/diag_funclit.d(108): Error: `(x, y, string z = "Hello") { return x; }` is not callable using argument types `(int, int, string, string)`
 fail_compilation/diag_funclit.d(108):        too many arguments, expected 3, got 4
-fail_compilation/diag_funclit.d(110): Error: function literal `__lambda_L110_C5(x, y, string z = "Hello")` is not callable using argument types `(int)`
+fail_compilation/diag_funclit.d(110): Error: `(x, y, string z = "Hello") { return x; }` is not callable using argument types `(int)`
 fail_compilation/diag_funclit.d(110):        too few arguments, expected 3, got 1
-fail_compilation/diag_funclit.d(112): Error: function literal `__lambda_L112_C5(x, y, z)` is not callable using argument types `(int)`
+fail_compilation/diag_funclit.d(112): Error: `(x, y, z) { return x; }` is not callable using argument types `(int)`
 fail_compilation/diag_funclit.d(112):        too few arguments, expected 3, got 1
-fail_compilation/diag_funclit.d(115): Error: function literal `__lambda_L115_C5(x, y, ...)` is not callable using argument types `(int)`
+fail_compilation/diag_funclit.d(115): Error: `(x, y, ...) { return x; }` is not callable using argument types `(int)`
 fail_compilation/diag_funclit.d(115):        too few arguments, expected 2, got 1
-fail_compilation/diag_funclit.d(117): Error: function literal `__lambda_L117_C5(x, y, string z = "Hey", ...)` is not callable using argument types `(int)`
+fail_compilation/diag_funclit.d(117): Error: `(x, y, string z = "Hey", ...) { return x; }` is not callable using argument types `(int)`
 fail_compilation/diag_funclit.d(117):        too few arguments, expected 3, got 1
 ---
  */
index 151bb426574dd366cdd207987e5ecdee4a30618a..fd17852f6b5bd60073280cbfbdae789318295d91 100644 (file)
@@ -4,7 +4,7 @@ TEST_OUTPUT:
 fail_compilation/diag_template_alias.d(1): Error: identifier expected for template `alias` parameter
 fail_compilation/diag_template_alias.d(1): Error: found `alias` when expecting `(`
 fail_compilation/diag_template_alias.d(1): Error: semicolon expected following function declaration, not `(`
-fail_compilation/diag_template_alias.d(1): Error: declaration expected, not `(`
+fail_compilation/diag_template_alias.d(1): Error: declaration expected, not `)`
 ---
  */
 #line 1
index 25de03ce19ed8e1b98e3b321bd6976f848c29f06..d4250f77e3f0dc9f57c6c2817ead031f2007b108 100644 (file)
@@ -4,7 +4,7 @@ TEST_OUTPUT:
 fail_compilation/diag_template_this.d(1): Error: identifier expected for template `this` parameter
 fail_compilation/diag_template_this.d(1): Error: found `this` when expecting `(`
 fail_compilation/diag_template_this.d(1): Error: semicolon expected following function declaration, not `(`
-fail_compilation/diag_template_this.d(1): Error: declaration expected, not `(`
+fail_compilation/diag_template_this.d(1): Error: declaration expected, not `)`
 ---
  */
 #line 1
index 0152cdee276f6c0c00f050dfcda823289337503b..70b79a2449b68adf62df5c7d5c223db23a9c41f7 100644 (file)
@@ -7,11 +7,11 @@ fail_compilation/e15876_1.d(18): Error: found `End of File` instead of statement
 fail_compilation/e15876_1.d(18): Error: matching `}` expected following compound statement, not `End of File`
 fail_compilation/e15876_1.d(17):        unmatched `{`
 fail_compilation/e15876_1.d(18): Error: found `End of File` when expecting `]`
-fail_compilation/e15876_1.d(18): Error: no identifier for declarator `o[()
+fail_compilation/e15876_1.d(18): Error: variable name expected after type `o[()
 {
 scope(exit) __error__
 }
-]`
+]`, not `End of File`
 ---
 */
 o[{scope(x
index 92164a4fd8b5aa9c3ab461661a100ea5914aeb6d..c996b95e336e5a1d528924dbc96ebd098ce51fac 100644 (file)
@@ -5,11 +5,11 @@ fail_compilation/e15876_2.d(16): Error: identifier expected following `template`
 fail_compilation/e15876_2.d(16): Error: matching `}` expected following compound statement, not `End of File`
 fail_compilation/e15876_2.d(15):        unmatched `{`
 fail_compilation/e15876_2.d(16): Error: found `End of File` when expecting `]`
-fail_compilation/e15876_2.d(16): Error: no identifier for declarator `o[()
+fail_compilation/e15876_2.d(16): Error: variable name expected after type `o[()
 {
 ;
 }
-]`
+]`, not `End of File`
 ---
 */
 o[{template
index 100c5e1ed5a9ea5ddcb52a12b9cdf6fda37582dd..7e9d70913d257cd1e66e6fa31819cfac8828197b 100644 (file)
@@ -13,7 +13,7 @@ fail_compilation/e15876_3.d(29): Error: found `End of File` instead of statement
 fail_compilation/e15876_3.d(29): Error: matching `}` expected following compound statement, not `End of File`
 fail_compilation/e15876_3.d(28):        unmatched `{`
 fail_compilation/e15876_3.d(29): Error: found `End of File` when expecting `)`
-fail_compilation/e15876_3.d(29): Error: no identifier for declarator `d(_error_ = ()
+fail_compilation/e15876_3.d(29): Error: variable name expected after type `d(_error_ = ()
 {
 for (__error__
  __error; __error)
@@ -21,7 +21,7 @@ for (__error__
 __error__
 }
 }
-)`
+)`, not `End of File`
 fail_compilation/e15876_3.d(29): Error: semicolon expected following function declaration, not `End of File`
 ---
 */
index a9115b92dd54d9af66496e405a37cbe3a831f8b0..76521671640cbfa0678fbfa078b8fa1a064e177a 100644 (file)
@@ -12,7 +12,7 @@ fail_compilation/e15876_4.d(27): Error: found `End of File` instead of statement
 fail_compilation/e15876_4.d(27): Error: matching `}` expected following compound statement, not `End of File`
 fail_compilation/e15876_4.d(26):        unmatched `{`
 fail_compilation/e15876_4.d(27): Error: found `End of File` when expecting `)`
-fail_compilation/e15876_4.d(27): Error: no identifier for declarator `typeof(()
+fail_compilation/e15876_4.d(27): Error: variable name expected after type `typeof(()
 {
 for (__error__
  __error; __error)
@@ -20,7 +20,7 @@ for (__error__
 __error__
 }
 }
-)`
+)`, not `End of File`
 ---
 */
 typeof){for
index 6bebc29fcb6473d4e632710376e37c605f90701a..42183b26bd098e28d6029317ea4f7f7ffff98e09 100644 (file)
@@ -6,11 +6,11 @@ fail_compilation/e15876_5.d(17): Error: semicolon expected to close `alias` decl
 fail_compilation/e15876_5.d(17): Error: matching `}` expected following compound statement, not `End of File`
 fail_compilation/e15876_5.d(16):        unmatched `{`
 fail_compilation/e15876_5.d(17): Error: found `End of File` when expecting `]`
-fail_compilation/e15876_5.d(17): Error: no identifier for declarator `p[()
+fail_compilation/e15876_5.d(17): Error: variable name expected after type `p[()
 {
 alias ;
 }
-]`
+]`, not `End of File`
 ---
 */
 p[{alias
index a8189ecb0af7a6f3e36a2dcd9a42d252576f0d59..0ebb92102394101e438fd83b41983b4f52810c2e 100644 (file)
@@ -1,7 +1,7 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/fail100.d(24): Error: cannot implicitly convert expression `f` of type `Class[]` to `I[]`
+fail_compilation/fail100.d(24): Error: return value `f` of type `Class[]` does not match return type `I[]`, and cannot be implicitly converted
 ---
 */
 
index 4349755519d17fa109ff312d87d6acf98f35de7b..457dda83f5210de1d360ff3613e3e4f61e7a13b8 100644 (file)
@@ -2,11 +2,11 @@
 TEST_OUTPUT:
 ---
 fail_compilation/fail11125.d(26): Error: template instance `fail11125.filter!(function (int a) pure nothrow @nogc @safe => a + 1)` does not match template declaration `filter(alias predfun)`
-  with `predfun = __lambda_L26_C13`
+  with `predfun = (int a) => a + 1`
   must satisfy the following constraint:
 `       is(ReturnType!predfun == bool)`
 fail_compilation/fail11125.d(27): Error: template instance `fail11125.filter!(function (int a) pure nothrow @nogc @safe => a + 1)` does not match template declaration `filter(alias predfun)`
-  with `predfun = __lambda_L27_C17`
+  with `predfun = (int a) => a + 1`
   must satisfy the following constraint:
 `       is(ReturnType!predfun == bool)`
 ---
index cabf87a6cae3463f747d97ae920b17e5d426bb81..26e633c27dbbc80f762a807159cfa3877c2fbfd1 100644 (file)
@@ -2,7 +2,7 @@
 TEST_OUTPUT:
 ---
 fail_compilation/fail11375.d(18): Error: constructor `fail11375.D!().D.this` is not `nothrow`
-       which calls `fail11375.B.this`
+       which calls `this`
 fail_compilation/fail11375.d(16): Error: function `D main` may throw but is marked as `nothrow`
 ---
 */
index b0e1b120c9cfd390c049f6d2240a16e4991db9d6..0f0c5ad6789badb8d51e4f2aa0b0aec696b04f4f 100644 (file)
@@ -1,10 +1,8 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/fail117.d(37): Error: expression `foo.mixin MGettor!(a) geta;
-` is `void` and has no value
-fail_compilation/fail117.d(38): Error: expression `foo.mixin MGettor!(b) getb;
-` is `void` and has no value
+fail_compilation/fail117.d(35): Error: expression `foo.mixin MGettor!(a) geta;` is `void` and has no value
+fail_compilation/fail117.d(36): Error: expression `foo.mixin MGettor!(b) getb;` is `void` and has no value
 ---
 */
 
index 36d7f9d8e302f5bef583b7d1e6ef0abaeeeb605b..b2d774b7544c766ea57f59863fb10c63f2f10fb2 100644 (file)
@@ -3,7 +3,7 @@ TEST_OUTPUT:
 ---
 fail_compilation/fail11751.d(10): Error: missing exponent
 fail_compilation/fail11751.d(10): Error: semicolon expected following auto declaration, not `ABC`
-fail_compilation/fail11751.d(10): Error: no identifier for declarator `ABC`
+fail_compilation/fail11751.d(10): Error: variable name expected after type `ABC`, not `;`
 ---
 */
 
index 1d1127c4c305b12f089be5afd1d07783b4322d53..cc73b5f9ba9cd6e0b8ab6a237d22eacf5b76220c 100644 (file)
@@ -17,7 +17,7 @@ void g1(char[] s) pure @nogc
 TEST_OUTPUT:
 ---
 fail_compilation/fail13120.d(35): Error: `pure` function `fail13120.h2` cannot call impure function `fail13120.g2!().g2`
-fail_compilation/fail13120.d(30):        which calls `fail13120.f2`
+fail_compilation/fail13120.d(30):        which calls `f2`
 fail_compilation/fail13120.d(35): Error: `@safe` function `fail13120.h2` cannot call `@system` function `fail13120.g2!().g2`
 fail_compilation/fail13120.d(27):        `fail13120.g2!().g2` is declared here
 fail_compilation/fail13120.d(35): Error: `@nogc` function `fail13120.h2` cannot call non-@nogc function `fail13120.g2!().g2`
index 1a7f16b55c5599c8663c91c6225b18afb38d0bb0..5533e24b0ec0eeb9d968bea35f8d1eb2b3e1a248 100644 (file)
@@ -1,9 +1,9 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/fail13424.d(12): Error: delegate `fail13424.S.__lambda_L12_C35` cannot be struct members
-fail_compilation/fail13424.d(17): Error: delegate `fail13424.U.__lambda_L17_C35` cannot be union members
-fail_compilation/fail13424.d(22): Error: delegate `fail13424.C.__lambda_L22_C35` cannot be class members
+fail_compilation/fail13424.d(12): Error: delegate `(dchar) { }` cannot be struct members
+fail_compilation/fail13424.d(17): Error: delegate `(dchar) { }` cannot be union members
+fail_compilation/fail13424.d(22): Error: delegate `(dchar) { }` cannot be class members
 ---
 */
 
index 27f47b3f7abd3f06512681e9c435e8f94cf8c698..e8099f3cd80b8937e31208f3c8f27530c88793eb 100644 (file)
@@ -1,7 +1,7 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/fail13498.d(11): Error: cannot implicitly convert expression `"foo"` of type `string` to `int`
+fail_compilation/fail13498.d(11): Error: return value `"foo"` of type `string` does not match return type `int`, and cannot be implicitly converted
 fail_compilation/fail13498.d(16): Error: template instance `fail13498.foo!()` error instantiating
 ---
 */
index f462a13a585203c1fc7cff0a099252b98761062b..4602d3de3bd61d3b0b6613dea0454db4a740eacb 100644 (file)
@@ -3,7 +3,7 @@
 TEST_OUTPUT:
 ---
 fail_compilation/fail16.d(19): Error: function declaration without return type. (Note that constructors are always named `this`)
-fail_compilation/fail16.d(19): Error: no identifier for declarator `bar!(typeof(X))(X)`
+fail_compilation/fail16.d(19): Error: variable name expected after type `bar!(typeof(X))(X)`, not `;`
 ---
 */
 
index 7f6672428bf6fe2b2f0228c21b54c147e3dbe578..89d63ae27982df50f3f2302f4740e0c8f50c49de 100644 (file)
@@ -3,29 +3,29 @@
 REQUIRED_ARGS: -m64
 TEST_OUTPUT:
 ---
-fail_compilation/fail16575.d(10): Error: function `fail16575.immNull` cannot have parameter of type `immutable(typeof(null))*` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(11): Error: function `fail16575.shaNull` cannot have parameter of type `shared(typeof(null))*` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(20): Error: function `fail16575.immNoReturn` cannot have parameter of type `immutable(noreturn)*` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(21): Error: function `fail16575.shaNoReturn` cannot have parameter of type `shared(noreturn)*` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(30): Error: function `fail16575.immBasic` cannot have parameter of type `immutable(int)*` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(31): Error: function `fail16575.shaBasic` cannot have parameter of type `shared(int)*` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(40): Error: function `fail16575.immVector` cannot have parameter of type `immutable(__vector(long[2]))*` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(41): Error: function `fail16575.shaVector` cannot have parameter of type `shared(__vector(long[2]))*` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(50): Error: function `fail16575.immSArray` cannot have parameter of type `immutable(long[2])` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(10): Error: function `immNull` cannot have parameter of type `immutable(typeof(null))*` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(11): Error: function `shaNull` cannot have parameter of type `shared(typeof(null))*` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(20): Error: function `immNoReturn` cannot have parameter of type `immutable(noreturn)*` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(21): Error: function `shaNoReturn` cannot have parameter of type `shared(noreturn)*` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(30): Error: function `immBasic` cannot have parameter of type `immutable(int)*` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(31): Error: function `shaBasic` cannot have parameter of type `shared(int)*` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(40): Error: function `immVector` cannot have parameter of type `immutable(__vector(long[2]))*` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(41): Error: function `shaVector` cannot have parameter of type `shared(__vector(long[2]))*` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(50): Error: function `immSArray` cannot have parameter of type `immutable(long[2])` because its linkage is `extern(C++)`
 fail_compilation/fail16575.d(50):        perhaps use a `long*` type instead
-fail_compilation/fail16575.d(51): Error: function `fail16575.shaSArray` cannot have parameter of type `shared(long[2])` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(51): Error: function `shaSArray` cannot have parameter of type `shared(long[2])` because its linkage is `extern(C++)`
 fail_compilation/fail16575.d(51):        perhaps use a `long*` type instead
-fail_compilation/fail16575.d(60): Error: function `fail16575.immPointer` cannot have parameter of type `immutable(int*)` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(61): Error: function `fail16575.shaPointer` cannot have parameter of type `shared(int*)` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(71): Error: function `fail16575.immStruct` cannot have parameter of type `immutable(SPP)*` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(72): Error: function `fail16575.shaStruct` cannot have parameter of type `shared(SPP)*` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(81): Error: function `fail16575.immClass` cannot have parameter of type `immutable(CPP)` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(82): Error: function `fail16575.shaClass` cannot have parameter of type `shared(CPP)` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(91): Error: function `fail16575.immEnum` cannot have parameter of type `immutable(EPP)*` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(92): Error: function `fail16575.shaEnum` cannot have parameter of type `shared(EPP)*` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(100): Error: function `fail16575.typeDArray` cannot have parameter of type `int[]` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(101): Error: function `fail16575.typeAArray` cannot have parameter of type `int[int]` because its linkage is `extern(C++)`
-fail_compilation/fail16575.d(102): Error: function `fail16575.typeDelegate` cannot have parameter of type `extern (C++) int delegate()` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(60): Error: function `immPointer` cannot have parameter of type `immutable(int*)` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(61): Error: function `shaPointer` cannot have parameter of type `shared(int*)` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(71): Error: function `immStruct` cannot have parameter of type `immutable(SPP)*` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(72): Error: function `shaStruct` cannot have parameter of type `shared(SPP)*` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(81): Error: function `immClass` cannot have parameter of type `immutable(CPP)` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(82): Error: function `shaClass` cannot have parameter of type `shared(CPP)` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(91): Error: function `immEnum` cannot have parameter of type `immutable(EPP)*` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(92): Error: function `shaEnum` cannot have parameter of type `shared(EPP)*` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(100): Error: function `typeDArray` cannot have parameter of type `int[]` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(101): Error: function `typeAArray` cannot have parameter of type `int[int]` because its linkage is `extern(C++)`
+fail_compilation/fail16575.d(102): Error: function `typeDelegate` cannot have parameter of type `extern (C++) int delegate()` because its linkage is `extern(C++)`
 ---
 */
 
index f8e0bae50d977d8584b07f1f24e5e8c0a99991fa..30a745ec809d0dee20b398ad7fbf5525b2f8dd8c 100644 (file)
@@ -2,7 +2,7 @@
 TEST_OUTPUT:
 ---
 fail_compilation/fail16689.d(3): Error: static assert:  "false"
-fail_compilation/fail16689.d(6):        instantiated from here: `Issue16689!()`
+fail_compilation/fail16689.d(6):        instantiated from here: `mixin Issue16689!();`
 ---
 */
 #line 1
index 0bc97512c9aebe59796493ecb99137f5404873fc..333ee6e98b58d4822fc2b9b22b5c5e5c37db2019 100644 (file)
@@ -1,7 +1,7 @@
 // https://issues.dlang.org/show_bug.cgi?id=16772
 /* TEST_OUTPUT:
 ---
-fail_compilation/fail16772.d(8): Error: function `fail16772.ice16772` cannot return type `ubyte[]` because its linkage is `extern(C++)`
+fail_compilation/fail16772.d(8): Error: function `ice16772` cannot return type `ubyte[]` because its linkage is `extern(C++)`
 fail_compilation/fail16772.d(8):        slices are specific to D and do not have a counterpart representation in C++
 ---
 */
index 9be7cd4b05fa65c90664243c0c931490a3667615..9cb3fa0d445c80d4d8c1ea854e75f455340efa27 100644 (file)
@@ -2,7 +2,7 @@
 TEST_OUTPUT:
 ---
 fail_compilation/fail17570.d(12): Error: cannot use function constraints for non-template functions. Use `static if` instead
-fail_compilation/fail17570.d(12): Error: declaration expected, not `if`
+fail_compilation/fail17570.d(13): Error: declaration expected, not `{`
 fail_compilation/fail17570.d(15): Error: `}` expected following members in `struct` declaration
 fail_compilation/fail17570.d(11):        struct `S` starts here
 ---
index 9b1ec1d458968ddfdbc59728d9839ea72fbe4c61..d7f76afc53ff5fcea37fb1af5e2e3fd22093dc82 100644 (file)
@@ -2,11 +2,11 @@
 TEST_OUTPUT:
 ---
 fail_compilation/fail18970.d(26): Error: no property `y` for `S()` of type `fail18970.S`
-fail_compilation/fail18970.d(26):        potentially malformed `opDispatch`. Use an explicit instantiation to get a better error message
-fail_compilation/fail18970.d(15):        struct `S` defined here
+fail_compilation/fail18970.d(19): Error: undefined identifier `x`
+fail_compilation/fail18970.d(26): Error: template instance `fail18970.S.opDispatch!"y"` error instantiating
 fail_compilation/fail18970.d(33): Error: no property `yyy` for `this` of type `fail18970.S2`
-fail_compilation/fail18970.d(33):        potentially malformed `opDispatch`. Use an explicit instantiation to get a better error message
-fail_compilation/fail18970.d(29):        struct `S2` defined here
+fail_compilation/fail18970.d(38): Error: undefined identifier `x`
+fail_compilation/fail18970.d(33): Error: template instance `fail18970.S2.opDispatch!"yyy"` error instantiating
 ---
 */
 
index cdb65ae0c8010c9bf18c8d6899dfda711ac8a1aa..2c8d98b5134810cd8b30e011c743110b764ebaaf 100644 (file)
@@ -1,7 +1,7 @@
 // https://issues.dlang.org/show_bug.cgi?id=19759
 /* TEST_OUTPUT:
 ---
-fail_compilation/fail19759.d(8): Error: function `fail19759.fail19759` cannot have parameter of type `float[4]` because its linkage is `extern(C++)`
+fail_compilation/fail19759.d(8): Error: function `fail19759` cannot have parameter of type `float[4]` because its linkage is `extern(C++)`
 fail_compilation/fail19759.d(8):        perhaps use a `float*` type instead
 ---
 */
index 01a9ede4622c6d2c45acfa53d5d915e33f61e58b..5353016d797dbf3a2b031b5533dce94d987d31ea 100644 (file)
@@ -3,7 +3,7 @@
 TEST_OUTPUT:
 ---
 fail_compilation/fail20073.d(20): Error: cannot implicitly convert expression `s` of type `S` to `string`
-fail_compilation/fail20073.d(21): Error: cannot implicitly convert expression `s` of type `S` to `string`
+fail_compilation/fail20073.d(21): Error: return value `s` of type `S` does not match return type `string`, and cannot be implicitly converted
 ---
 */
 
index 8410af535e2f9f5506aeec189a02fc8c44afc53a..dbd0061ef880a40a18f452bb236be12dc8c20580 100644 (file)
@@ -3,7 +3,7 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/fail20376.d(17): Error: cannot implicitly convert expression `Foo()` of type `Foo` to `ubyte`
+fail_compilation/fail20376.d(17): Error: return value `Foo()` of type `Foo` does not match return type `ubyte`, and cannot be implicitly converted
 ---
 */
 
index b3b42f342962b646e8f3a324020f7b6dc2f7867a..5dc85ca9be36254cccf1bfeba10328478792e0a1 100644 (file)
@@ -1,7 +1,7 @@
 // https://issues.dlang.org/show_bug.cgi?id=21206
 /* TEST_OUTPUT:
 ---
-fail_compilation/fail21206.d(10): Error: function `fail21206.Obj.toString` cannot return type `string` because its linkage is `extern(C++)`
+fail_compilation/fail21206.d(10): Error: function `toString` cannot return type `string` because its linkage is `extern(C++)`
 fail_compilation/fail21206.d(10):        slices are specific to D and do not have a counterpart representation in C++
 ---
 */
index 1de2a13044afb3ce60a9de6bd69a42c9cfe16eb4..47c6018d138efee6868efac6e0c67f879e1c31da 100644 (file)
@@ -1,7 +1,7 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/fail22.d(13): Error: no identifier for declarator `char`
+fail_compilation/fail22.d(13): Error: variable name expected after type `char`, not `;`
 ---
 */
 
index 8b525d85fb2c2bc021e6028d43a75ea2820c440c..c172f089d9c7abf2aaabb1b0af631ee053e02991 100644 (file)
@@ -3,12 +3,10 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/fail22054.d(23): Error: no property `what` for type `fail22054.exception`
-fail_compilation/fail22054.d(18):        `class fail22054.exception` is opaque and has no members.
-fail_compilation/fail22054.d(18):        class `exception` defined here
-fail_compilation/fail22054.d(24): Error: no property `what` for type `fail22054.exception2`
-fail_compilation/fail22054.d(19):        `struct fail22054.exception2` is opaque and has no members.
-fail_compilation/fail22054.d(19):        struct `exception2` defined here
+fail_compilation/fail22054.d(21): Error: no property `what` for type `fail22054.exception`
+fail_compilation/fail22054.d(16):        `class fail22054.exception` is opaque and has no members.
+fail_compilation/fail22054.d(22): Error: no property `what` for type `fail22054.exception2`
+fail_compilation/fail22054.d(17):        `struct fail22054.exception2` is opaque and has no members.
 ---
 */
 
index 82118d5de4526faf39a59762a83e014533c37304..b61df87b52f60dc7344ad3e7f91d43a1fc14c0b1 100644 (file)
@@ -2,10 +2,8 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/fail2450.d(22): Error: function expected before `()`, not `this.mixin Event!() clicked;
-` of type `void`
-fail_compilation/fail2450.d(25): Error: function expected before `()`, not `b.mixin Event!() clicked;
-` of type `void`
+fail_compilation/fail2450.d(20): Error: function expected before `()`, not `this.mixin Event!() clicked;` of type `void`
+fail_compilation/fail2450.d(23): Error: function expected before `()`, not `b.mixin Event!() clicked;` of type `void`
 ---
 */
 
index bf745ac8bbd0424b3eb28757aea6800a68fbec3c..60de5971ac9b354517ddd1b1fe1260416bbaec3f 100644 (file)
@@ -4,7 +4,7 @@ TEST_OUTPUT:
 fail_compilation/fail3673b.d(12): Error: basic type expected, not `if`
 fail_compilation/fail3673b.d(12): Error: template constraints only allowed for templates
 fail_compilation/fail3673b.d(12): Error: { } expected following `class` declaration
-fail_compilation/fail3673b.d(12): Error: no identifier for declarator `A`
+fail_compilation/fail3673b.d(12): Error: variable name expected after type `A`, not `{`
 fail_compilation/fail3673b.d(12): Error: declaration expected, not `{`
 ---
 */
index 8a95b34e891efb66e544b838dd6cd19192cbe60f..33f9ea1ec31201b1af502dca628a34a67f734671 100644 (file)
@@ -2,7 +2,7 @@
 TEST_OUTPUT:
 ---
 fail_compilation/fail4269e.d(10): Error: semicolon needed to end declaration of `Y` instead of `X5`
-fail_compilation/fail4269e.d(10): Error: no identifier for declarator `X5`
+fail_compilation/fail4269e.d(10): Error: variable name expected after type `X5`, not `;`
 ---
 */
 
index cf1554da23589563cbeb6d58214aa2ffbb9d0bb7..1cb0292cc8c7e38526ad9e7ad39e64557860b187 100644 (file)
@@ -3,7 +3,7 @@ TEST_OUTPUT:
 ---
 fail_compilation/fail4544.d(15): Error: character constant has multiple characters
 fail_compilation/fail4544.d(16): Error: `0x` isn't a valid integer literal, use `0x0` instead
-fail_compilation/fail4544.d(16): Error: no identifier for declarator `int`
+fail_compilation/fail4544.d(16): Error: variable name expected after type `int`, not `0`
 fail_compilation/fail4544.d(17): Error: unterminated character constant
 fail_compilation/fail4544.d(18): Error: character constant has multiple characters
 ---
index 7abdb9e26a378790419a52a002e016f6398b4e2d..4afe65462242549189ddd9d6748a44a4b400e207 100644 (file)
@@ -2,7 +2,7 @@
 TEST_OUTPUT:
 ---
 fail_compilation/fail6334.d(13): Error: static assert:  `0` is false
-fail_compilation/fail6334.d(11):        instantiated from here: `T2!()`
+fail_compilation/fail6334.d(11):        instantiated from here: `mixin T2!();`
 ---
 */
 
index a12fa3f4cc6905decf9e8891588f18a23c3042a0..4f119f2aa9b76ea24054c41089694d0fe592139e 100644 (file)
@@ -1,7 +1,7 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/fail99.d(13): Error: delegate `dg(int)` is not callable using argument types `()`
+fail_compilation/fail99.d(13): Error: delegate `dg` is not callable using argument types `()`
 fail_compilation/fail99.d(13):        too few arguments, expected 1, got 0
 ---
 */
index 51275d0140e2b084bef20aec9a94e725f1950613..b6c3bc906a1533f7b5c5a7ba00fcb3808471553f 100644 (file)
@@ -3,7 +3,7 @@
 fail_compilation/failcontracts.d(17): Error: missing `{ ... }` for function literal
 fail_compilation/failcontracts.d(17): Error: semicolon expected following auto declaration, not `bode`
 fail_compilation/failcontracts.d(18): Error: function declaration without return type. (Note that constructors are always named `this`)
-fail_compilation/failcontracts.d(18): Error: no identifier for declarator `test1()`
+fail_compilation/failcontracts.d(18): Error: variable name expected after type `test1()`, not `bode`
 fail_compilation/failcontracts.d(18): Error: semicolon expected following function declaration, not `bode`
 fail_compilation/failcontracts.d(19): Error: semicolon expected following function declaration, not `bode`
 fail_compilation/failcontracts.d(21): Error: unexpected `(` in declarator
index 21603f725f66f5761405e07c11ef85aea6ede31d..6369bdc5baf4061f6b0a759a9e8dc260a7af40dc 100644 (file)
@@ -2,9 +2,9 @@
 TEST_OUTPUT:
 ---
 fail_compilation/fnconstraint.d(14): Error: template constraint must follow parameter lists and attributes
-fail_compilation/fnconstraint.d(14): Error: declaration expected, not `if`
+fail_compilation/fnconstraint.d(15): Error: declaration expected, not `{`
 fail_compilation/fnconstraint.d(23): Error: template constraint must follow parameter lists and attributes
-fail_compilation/fnconstraint.d(23): Error: declaration expected, not `if`
+fail_compilation/fnconstraint.d(23): Error: declaration expected, not `{`
 fail_compilation/fnconstraint.d(27): Error: `}` expected following members in `struct` declaration
 fail_compilation/fnconstraint.d(19):        struct `S` starts here
 ---
index fc6c593ae0a638049a18bc2d5b44cf0f049ef6ab..4f052b281939112a2d7a703592081da9ee327fe3 100644 (file)
@@ -1,7 +1,7 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/ice10922.d(11): Error: function `__lambda_L10_C12` is not callable using argument types `()`
+fail_compilation/ice10922.d(11): Error: function `(in uint n) { enum self = __lambda_L10_C12; return n < 2 ? n : self(n - 1) + ...` is not callable using argument types `()`
 fail_compilation/ice10922.d(11):        too few arguments, expected 1, got 0
 fail_compilation/ice10922.d(10):        `ice10922.__lambda_L10_C12(in uint n)` declared here
 ---
index 4d107c9e7b259ffa575c03e95852c8a62402f679..16eaa99b3d813515335643936871366f1cb5b013 100644 (file)
@@ -2,8 +2,8 @@
 TEST_OUTPUT:
 ---
 fail_compilation/ice10938.d(14): Error: no property `opts` for `this` of type `ice10938.C`
-fail_compilation/ice10938.d(14):        potentially malformed `opDispatch`. Use an explicit instantiation to get a better error message
-fail_compilation/ice10938.d(10):        class `C` defined here
+fail_compilation/ice10938.d(19): Error: forward reference to inferred return type of function call `this.opDispatch()`
+fail_compilation/ice10938.d(14): Error: template instance `ice10938.C.opDispatch!"opts"` error instantiating
 ---
 */
 
index 6a1b89ba776bb156f439175977d9e9bd0509c895..826bd8cd7ec16093fd5e418bbf67c4933f10cc27 100644 (file)
@@ -2,7 +2,7 @@
 TEST_OUTPUT:
 ---
 fail_compilation/ice11153.d(11): Error: function declaration without return type. (Note that constructors are always named `this`)
-fail_compilation/ice11153.d(11): Error: no identifier for declarator `foo()`
+fail_compilation/ice11153.d(11): Error: variable name expected after type `foo()`, not `{`
 ---
 */
 
index 39eb120827a3819237051d0f96a805265d8d7165..165945b6f438a653c73ef44a838d7c5652f34ee3 100644 (file)
@@ -3,7 +3,7 @@ TEST_OUTPUT:
 ---
 fail_compilation/ice11963.d(10): Error: unexpected `(` in declarator
 fail_compilation/ice11963.d(10): Error: identifier expected for template type parameter
-fail_compilation/ice11963.d(10): Error: no identifier for declarator `A`
+fail_compilation/ice11963.d(10): Error: variable name expected after type `A`, not `""`
 fail_compilation/ice11963.d(10): Error: declaration expected, not `""`
 ---
 */
index 9e6da3bbf8444dfdc90fcaee2f2dc19db143dc67..79d15aa5a6ff749866ca6954520822b1f860bf2c 100644 (file)
@@ -1,15 +1,15 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/ice11965.d(16): Error: no identifier for declarator `b*`
+fail_compilation/ice11965.d(16): Error: variable name expected after type `b*`, not `End of File`
 fail_compilation/ice11965.d(16): Error: matching `}` expected following compound statement, not `End of File`
 fail_compilation/ice11965.d(15):        unmatched `{`
 fail_compilation/ice11965.d(16): Error: found `End of File` when expecting `]`
-fail_compilation/ice11965.d(16): Error: no identifier for declarator `u[()
+fail_compilation/ice11965.d(16): Error: variable name expected after type `u[()
 {
 b* A;
 }
-]`
+]`, not `End of File`
 ---
 */
 u[{b*A,
index 5d1cea1de72bd5bf944dc7fc0002070dc0bf9b60..da630913b20817d9fc61cee6cf6353ed76780f3f 100644 (file)
@@ -12,7 +12,7 @@ fail_compilation/ice15855.d(28): Error: found `End of File` instead of statement
 fail_compilation/ice15855.d(28): Error: matching `}` expected following compound statement, not `End of File`
 fail_compilation/ice15855.d(27):        unmatched `{`
 fail_compilation/ice15855.d(28): Error: found `End of File` when expecting `]`
-fail_compilation/ice15855.d(28): Error: no identifier for declarator `a[()
+fail_compilation/ice15855.d(28): Error: variable name expected after type `a[()
 {
 for (__error__
  __error; __error)
@@ -20,7 +20,7 @@ for (__error__
 __error__
 }
 }
-]`
+]`, not `End of File`
 ---
 */
 
index 686e700cae9b13878e2271c6aba38341173ab64b..b9e1a927813cc8335afdf403eef2e9e4b501e636 100644 (file)
@@ -1,7 +1,7 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/ice22377.d(8): Error: function `ice22377.foo` cannot have parameter of type `string` because its linkage is `extern(C++)`
+fail_compilation/ice22377.d(8): Error: function `foo` cannot have parameter of type `string` because its linkage is `extern(C++)`
 ---
 */
 
index a9f6f7253acbf6e52e6d8e104156584c868c92c1..48e35e2ed0e43398b911d6a1aafdfcc155f64746 100644 (file)
@@ -1,7 +1,7 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/ice8309.d(10): Error: incompatible types for `(__lambda_L10_C15) : (__lambda_L10_C24)`: `double function() pure nothrow @nogc @safe` and `int function() pure nothrow @nogc @safe`
+fail_compilation/ice8309.d(10): Error: incompatible types for `(() => 1.0) : (() => 1)`: `double function() pure nothrow @nogc @safe` and `int function() pure nothrow @nogc @safe`
 ---
 */
 
index c1807a0f542c2520ed5b5163a5bbc9f8405eab57..f9032ec0e88a36be00eec9a926ce4ddcd1873826 100644 (file)
@@ -1,8 +1,7 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/ice9406.d(22): Error: `s1.mixin Mixin!() t1;
-` has no effect
+fail_compilation/ice9406.d(21): Error: `s1.mixin Mixin!() t1;` has no effect
 ---
 */
 
index 79eda2ea08c1a4850409eddc8fa61282d93cdf07..9f1f3776388131f94251f2211c460ed95a0334a7 100644 (file)
@@ -1,10 +1,11 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/issue16020.d(13): Error: user-defined attributes not allowed for `alias` declarations
-fail_compilation/issue16020.d(14): Error: semicolon expected to close `alias` declaration, not `(`
-fail_compilation/issue16020.d(14): Error: declaration expected, not `(`
-fail_compilation/issue16020.d(15): Deprecation: storage class `final` has no effect in type aliases
+fail_compilation/issue16020.d(14): Error: user-defined attributes not allowed for `alias` declarations
+fail_compilation/issue16020.d(15): Error: semicolon expected to close `alias` declaration, not `(`
+fail_compilation/issue16020.d(15): Error: semicolon needed to end declaration of `t` instead of `)`
+fail_compilation/issue16020.d(15): Error: declaration expected, not `)`
+fail_compilation/issue16020.d(16): Deprecation: storage class `final` has no effect in type aliases
 ---
 */
 module issue16020;
index 90e42d83e9911a0c43aadf3ef1e2362a53a52c5e..957c0809d5db6282d3ebad843a73e4870c5afdc5 100644 (file)
@@ -5,7 +5,7 @@ fail_compilation/misc1.d(109): Error: `5` has no effect
 fail_compilation/misc1.d(110): Error: `1 + 2` has no effect
 fail_compilation/misc1.d(111): Error: `x` has no effect
 fail_compilation/misc1.d(117): Deprecation: `1 * 1` has no effect
-fail_compilation/misc1.d(118): Deprecation: `__lambda_L118_C34` has no effect
+fail_compilation/misc1.d(118): Deprecation: `() { j++; d++; }` has no effect
 fail_compilation/misc1.d(124): Deprecation: `false` has no effect
 fail_compilation/misc1.d(127): Deprecation: `*sp++` has no effect
 fail_compilation/misc1.d(128): Deprecation: `j` has no effect
index 6fa115a6a8ac7ad526f26c087edf6d0358d90e74..17daa96358b17a70d311db13285a8bf4ef6e1d48 100644 (file)
@@ -44,10 +44,10 @@ fail_compilation/nogc3.d(35): Error: `@nogc` function `nogc3.testCall` cannot ca
 TEST_OUTPUT:
 ---
 fail_compilation/nogc3.d(54): Error: function `nogc3.testClosure1` is `@nogc` yet allocates closure for `testClosure1()` with the GC
-fail_compilation/nogc3.d(57):        function `nogc3.testClosure1.bar` closes over variable `x`
+fail_compilation/nogc3.d(57):        function `bar` closes over variable `x`
 fail_compilation/nogc3.d(56):        `x` declared here
 fail_compilation/nogc3.d(66): Error: function `nogc3.testClosure3` is `@nogc` yet allocates closure for `testClosure3()` with the GC
-fail_compilation/nogc3.d(69):        function `nogc3.testClosure3.bar` closes over variable `x`
+fail_compilation/nogc3.d(69):        function `bar` closes over variable `x`
 fail_compilation/nogc3.d(68):        `x` declared here
 ---
 */
index 66c1d5287f59960d0cc251e5ae0b405f78f4e3de..ec6bd3ebce99645594b8462b487e95b78453e1a5 100644 (file)
@@ -55,7 +55,7 @@ NR returns()
 /+
 TEST_OUTPUT:
 ---
-fail_compilation/noreturn2.d(64): Error: cannot implicitly convert expression `1` of type `int` to `noreturn`
+fail_compilation/noreturn2.d(64): Error: return value `1` of type `int` does not match return type `noreturn`, and cannot be implicitly converted
 ---
 +/
 
index 3eef0f92937210c980f82c9ceba12d18b430e148..872a44796f804d5d1baedd20a2df3bda77e0c013 100644 (file)
@@ -1,7 +1,7 @@
 /* TEST_OUTPUT:
 ---
 fail_compilation/opapplyscope.d(113): Error: function `opapplyscope.S.opApply(scope int delegate(scope int* ptr) @safe dg)` is not callable using argument types `(int delegate(int* x) nothrow @nogc @safe)`
-fail_compilation/opapplyscope.d(113):        cannot pass argument `__foreachbody_L113_C5` of type `int delegate(int* x) nothrow @nogc @safe` to parameter `scope int delegate(scope int* ptr) @safe dg`
+fail_compilation/opapplyscope.d(113):        cannot pass argument `int(int* x) => 0` of type `int delegate(int* x) nothrow @nogc @safe` to parameter `scope int delegate(scope int* ptr) @safe dg`
 ---
  */
 
index c9aa70aa79303ea107ff6686e7edaa1693c0b6bc..3777cf6a958747fd13de45c6d10e933e288198c5 100644 (file)
@@ -1,7 +1,7 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/parse14285.d(10): Error: no identifier for declarator `this`
+fail_compilation/parse14285.d(10): Error: variable name expected after type `this`, not `;`
 ---
 */
 
index 77f8e438563bfd0c7345591957853d3132649203..3ae5de009933f30f05b7a497ebdd715a0b080389 100644 (file)
@@ -3,13 +3,13 @@ REQUIRED_ARGS: -preview=in -preview=dip1000
 TEST_OUTPUT:
 ----
 fail_compilation/previewin.d(4): Error: function `takeFunction` is not callable using argument types `(void function(real x) pure nothrow @nogc @safe)`
-fail_compilation/previewin.d(4):        cannot pass argument `__lambda_L4_C18` of type `void function(real x) pure nothrow @nogc @safe` to parameter `void function(in real) f`
+fail_compilation/previewin.d(4):        cannot pass argument `(real x) { }` of type `void function(real x) pure nothrow @nogc @safe` to parameter `void function(in real) f`
 fail_compilation/previewin.d(11):        `previewin.takeFunction(void function(in real) f)` declared here
 fail_compilation/previewin.d(5): Error: function `takeFunction` is not callable using argument types `(void function(scope const(real) x) pure nothrow @nogc @safe)`
-fail_compilation/previewin.d(5):        cannot pass argument `__lambda_L5_C18` of type `void function(scope const(real) x) pure nothrow @nogc @safe` to parameter `void function(in real) f`
+fail_compilation/previewin.d(5):        cannot pass argument `(scope const(real) x) { }` of type `void function(scope const(real) x) pure nothrow @nogc @safe` to parameter `void function(in real) f`
 fail_compilation/previewin.d(11):        `previewin.takeFunction(void function(in real) f)` declared here
 fail_compilation/previewin.d(6): Error: function `takeFunction` is not callable using argument types `(void function(ref scope const(real) x) pure nothrow @nogc @safe)`
-fail_compilation/previewin.d(6):        cannot pass argument `__lambda_L6_C18` of type `void function(ref scope const(real) x) pure nothrow @nogc @safe` to parameter `void function(in real) f`
+fail_compilation/previewin.d(6):        cannot pass argument `(ref scope const(real) x) { }` of type `void function(ref scope const(real) x) pure nothrow @nogc @safe` to parameter `void function(in real) f`
 fail_compilation/previewin.d(11):        `previewin.takeFunction(void function(in real) f)` declared here
 fail_compilation/previewin.d(15): Error: assigning scope variable `arg` to global variable `myGlobal` is not allowed in a `@safe` function
 fail_compilation/previewin.d(16): Error: assigning scope variable `arg` to global variable `myGlobal` is not allowed in a `@safe` function
index 0c2d86a6b2a6336dd03d9e11d49e8e25a3d04813..39fa8ab57afd492ce2c85a4fa49fc81cf99c5532 100644 (file)
@@ -55,7 +55,7 @@ void test2(scope int* p, int[] a ...) @safe
 TEST_OUTPUT:
 ---
 fail_compilation/retscope.d(75): Error: function `retscope.HTTP.Impl.onReceive` is `@nogc` yet allocates closure for `onReceive()` with the GC
-fail_compilation/retscope.d(77):        delegate `retscope.HTTP.Impl.onReceive.__lambda_L77_C23` closes over variable `this`
+fail_compilation/retscope.d(77):        delegate `() => this.x` closes over variable `this`
 ---
 */
 
@@ -164,6 +164,7 @@ class C11
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope.d(177): Error: assigning address of variable `i` to `p` with longer lifetime is not allowed in a `@safe` function
 ---
 */
 
@@ -180,6 +181,7 @@ void foo11() @safe
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope.d(197): Error: returning scope variable `e` is not allowed in a `@safe` function
 ---
 */
 
@@ -199,8 +201,6 @@ void* escapeDg1(scope void* d) @safe
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/retscope.d(176): Error: assigning address of variable `i` to `p` with longer lifetime is not allowed in a `@safe` function
-fail_compilation/retscope.d(195): Error: returning scope variable `e` is not allowed in a `@safe` function
 fail_compilation/retscope.d(212): Error: assigning scope variable `p` to non-scope `e.e` is not allowed in a `@safe` function
 ---
 */
@@ -234,10 +234,10 @@ void* funretscope(scope dg_t ptr) @safe
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/retscope.d(248): Error: cannot implicitly convert expression `__lambda_L248_C21` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() scope @safe`
-fail_compilation/retscope.d(248): Error: cannot implicitly convert expression `__lambda_L248_C21` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() scope @safe`
-fail_compilation/retscope.d(249): Error: cannot implicitly convert expression `__lambda_L249_C21` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() scope @safe`
-fail_compilation/retscope.d(249): Error: cannot implicitly convert expression `__lambda_L249_C21` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() scope @safe`
+fail_compilation/retscope.d(248): Error: cannot implicitly convert expression `() => & x` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() scope @safe`
+fail_compilation/retscope.d(248): Error: cannot implicitly convert expression `() => & x` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() scope @safe`
+fail_compilation/retscope.d(249): Error: cannot implicitly convert expression `() => & x` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() scope @safe`
+fail_compilation/retscope.d(249): Error: cannot implicitly convert expression `() => & x` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() scope @safe`
 ---
 */
 
@@ -254,6 +254,7 @@ void escape4() @safe
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope.d(266): Error: taking address of `scope` variable `p` with pointers is not allowed in a `@safe` function
 ---
 */
 
@@ -270,7 +271,6 @@ void escape5() @safe
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/retscope.d(265): Error: taking address of `scope` variable `p` with pointers is not allowed in a `@safe` function
 fail_compilation/retscope.d(286): Error: escaping a reference to local variable `b` by returning `foo6(& b)`  is not allowed in a `@safe` function
 ---
 */
@@ -323,6 +323,7 @@ ref int[3] asStatic2(      scope int[] p) @safe { return p[0 .. 3]; }
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope.d(335): Error: assigning reference to local variable `i` to non-scope `f` is not allowed in a `@safe` function
 ---
 */
 
@@ -346,7 +347,6 @@ int* bar10( scope int** ptr ) @safe
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/retscope.d(334): Error: assigning reference to local variable `i` to non-scope `f` is not allowed in a `@safe` function
 fail_compilation/retscope.d(358): Error: taking address of `scope` variable `aa` with pointers is not allowed in a `@safe` function
 ---
 */
@@ -399,6 +399,7 @@ struct Foo12
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope.d(1103): Error: returning scope variable `f` is not allowed in a `@safe` function
 ---
 */
 
@@ -418,6 +419,7 @@ class Foo13
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope.d(1205): Error: scope variable `f14` calling non-scope member function `Foo14.foo()` is not allowed in a `@safe` function
 ---
 */
 
@@ -440,6 +442,7 @@ struct Foo14
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope.d(1311): Error: assigning scope variable `u2` to `ek` with longer lifetime is not allowed in a `@safe` function
 ---
 */
 
@@ -467,6 +470,7 @@ TEST_OUTPUT:
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope.d(1405): Error: assigning reference to local variable `buf` to non-scope anonymous parameter calling `myprintf` is not allowed in a `@safe` function
 ---
 */
 
@@ -484,10 +488,6 @@ TEST_OUTPUT:
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/retscope.d(1103): Error: returning scope variable `f` is not allowed in a `@safe` function
-fail_compilation/retscope.d(1205): Error: scope variable `f14` calling non-scope member function `Foo14.foo()` is not allowed in a `@safe` function
-fail_compilation/retscope.d(1311): Error: assigning scope variable `u2` to `ek` with longer lifetime is not allowed in a `@safe` function
-fail_compilation/retscope.d(1405): Error: assigning reference to local variable `buf` to non-scope anonymous parameter calling `myprintf` is not allowed in a `@safe` function
 fail_compilation/retscope.d(1509): Error: assigning reference to stack allocated value returned by `(*fp15)()` to non-scope anonymous parameter is not allowed in a `@safe` function
 ---
 */
index 4638cdc139abf8aee4784ced554a480c3ced49c8..f663e4f4fb06c77ccdf83928d5d1c689d179e2fc 100644 (file)
@@ -2,6 +2,8 @@
 REQUIRED_ARGS: -preview=dip1000
 TEST_OUTPUT:
 ---
+fail_compilation/retscope2.d(102): Error: assigning scope variable `s` to `ref` variable `p` with longer lifetime is not allowed in a `@safe` function
+fail_compilation/retscope2.d(107): Error: assigning address of variable `s` to `p` with longer lifetime is not allowed in a `@safe` function
 ---
 */
 
@@ -34,6 +36,7 @@ void test200()
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope2.d(302): Error: assigning scope variable `a` to return scope `b` is not allowed in a `@safe` function
 ---
 */
 
@@ -49,6 +52,7 @@ TEST_OUTPUT:
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope2.d(403): Error: assigning scope variable `a` to return scope `c` is not allowed in a `@safe` function
 ---
 */
 
@@ -65,6 +69,7 @@ TEST_OUTPUT:
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope2.d(504): Error: returning scope variable `c` is not allowed in a `@safe` function
 ---
 */
 
@@ -81,11 +86,6 @@ TEST_OUTPUT:
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/retscope2.d(102): Error: assigning scope variable `s` to `ref` variable `p` with longer lifetime is not allowed in a `@safe` function
-fail_compilation/retscope2.d(107): Error: assigning address of variable `s` to `p` with longer lifetime is not allowed in a `@safe` function
-fail_compilation/retscope2.d(302): Error: assigning scope variable `a` to return scope `b` is not allowed in a `@safe` function
-fail_compilation/retscope2.d(403): Error: assigning scope variable `a` to return scope `c` is not allowed in a `@safe` function
-fail_compilation/retscope2.d(504): Error: returning scope variable `c` is not allowed in a `@safe` function
 fail_compilation/retscope2.d(604): Error: assigning scope variable `__param_0` to non-scope anonymous parameter calling `foo600` is not allowed in a `@safe` function
 fail_compilation/retscope2.d(604): Error: assigning scope variable `__param_1` to non-scope anonymous parameter calling `foo600` is not allowed in a `@safe` function
 fail_compilation/retscope2.d(614): Error: template instance `retscope2.test600!(int*, int*)` error instantiating
@@ -115,6 +115,8 @@ fail_compilation/retscope2.d(614): Error: template instance `retscope2.test600!(
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope2.d(719): Error: returning `get2(s)` escapes a reference to local variable `s`
+fail_compilation/retscope2.d(721): Error: returning `s.get1()` escapes a reference to local variable `s`
 ---
 */
 
@@ -148,6 +150,7 @@ S700* escape700(int i) @safe
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope2.d(804): Error: throwing scope variable `e` is not allowed in a `@safe` function
 ---
 */
 
@@ -164,6 +167,7 @@ void foo800() @safe
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope2.d(907): Error: assigning address of variable `this` to `p17568` with longer lifetime is not allowed in a `@safe` function
 ---
 */
 
@@ -184,6 +188,9 @@ struct T17568
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope2.d(1005): Error: assigning scope variable `p` to non-scope `this._p` is not allowed in a `@safe` function
+fail_compilation/retscope2.d(1021): Error: assigning scope variable `p` to non-scope `c._p` is not allowed in a `@safe` function
+fail_compilation/retscope2.d(1024): Error: assigning scope variable `p` to non-scope `d._p` is not allowed in a `@safe` function
 ---
 */
 
@@ -222,6 +229,7 @@ void test17428() @safe
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope2.d(1107): Error: returning scope variable `dg` is not allowed in a `@safe` function
 ---
 */
 
@@ -241,6 +249,8 @@ void delegate() test17430() @safe
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope2.d(1216): Error: returning `s.foo()` escapes a reference to local variable `s`
+fail_compilation/retscope2.d(1233): Error: returning `t.foo()` escapes a reference to local variable `t`
 ---
 */
 
@@ -286,16 +296,6 @@ struct T17388
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/retscope2.d(719): Error: returning `get2(s)` escapes a reference to local variable `s`
-fail_compilation/retscope2.d(721): Error: returning `s.get1()` escapes a reference to local variable `s`
-fail_compilation/retscope2.d(804): Error: throwing scope variable `e` is not allowed in a `@safe` function
-fail_compilation/retscope2.d(907): Error: assigning address of variable `this` to `p17568` with longer lifetime is not allowed in a `@safe` function
-fail_compilation/retscope2.d(1005): Error: assigning scope variable `p` to non-scope `this._p` is not allowed in a `@safe` function
-fail_compilation/retscope2.d(1021): Error: assigning scope variable `p` to non-scope `c._p` is not allowed in a `@safe` function
-fail_compilation/retscope2.d(1024): Error: assigning scope variable `p` to non-scope `d._p` is not allowed in a `@safe` function
-fail_compilation/retscope2.d(1107): Error: returning scope variable `dg` is not allowed in a `@safe` function
-fail_compilation/retscope2.d(1216): Error: returning `s.foo()` escapes a reference to local variable `s`
-fail_compilation/retscope2.d(1233): Error: returning `t.foo()` escapes a reference to local variable `t`
 fail_compilation/retscope2.d(1306): Error: escaping a reference to local variable `i` by copying `& i` into allocated memory is not allowed in a `@safe` function
 ---
 */
index 819071f15d04b65cd94bdc243bfb7270ba8989cb..438fdd76e1b03a4caead2093f48ec85d180f8219 100644 (file)
@@ -5,6 +5,8 @@ REQUIRED_ARGS: -preview=dip1000
 /*
 TEST_OUTPUT:
 ---
+fail_compilation/retscope3.d(2008): Error: escaping a reference to local variable `i` by copying `& i` into allocated memory is not allowed in a `@safe` function
+fail_compilation/retscope3.d(2017): Error: escaping a reference to local variable `i` by copying `S2000(& i)` into allocated memory is not allowed in a `@safe` function
 ---
 */
 
@@ -51,8 +53,6 @@ void bar4()
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/retscope3.d(2008): Error: escaping a reference to local variable `i` by copying `& i` into allocated memory is not allowed in a `@safe` function
-fail_compilation/retscope3.d(2017): Error: escaping a reference to local variable `i` by copying `S2000(& i)` into allocated memory is not allowed in a `@safe` function
 fail_compilation/retscope3.d(4003): Error: escaping a reference to parameter `u` by copying `u[]` into allocated memory is not allowed in a `@safe` function
 fail_compilation/retscope3.d(4016): Error: storing reference to outer local variable `i` into allocated memory causes it to escape
 fail_compilation/retscope3.d(4025): Error: escaping reference to stack allocated value returned by `makeSA()` into allocated memory
index 1af95949d7aa755f1a628e70f43ce124df769f4c..7ab1d7cd17379124b131259f12aca2d7d8e1d2bc 100644 (file)
@@ -96,7 +96,7 @@ fail_compilation/shared.d(2216):        return value `getSharedObject()` is not
 fail_compilation/shared.d(2222): Error: direct access to shared `a` is not allowed, see `core.atomic`
 fail_compilation/shared.d(2220): Error: function `shared.test_inference_4` function returns `shared` but cannot be inferred `ref`
 fail_compilation/shared.d(2222):        cannot implicitly convert `a` of type `shared(const(Object))` to `object.Object`
-fail_compilation/shared.d(2222): Error: cannot implicitly convert expression `a` of type `shared(const(Object))` to `object.Object`
+fail_compilation/shared.d(2222): Error: return value `a` of type `shared(const(Object))` does not match return type `object.Object`, and cannot be implicitly converted
 ---
  */
 
index 88f6d83632b6e9dcd3739820a3bb21a05a71c438..9dd0716884322a50fd33de8668a74aa6d1e26c10 100644 (file)
@@ -3,7 +3,7 @@ REQUIRED_ARGS: -de
 TEST_OUTPUT:
 ---
 fail_compilation/systemvariables_deprecation.d(15): Deprecation: `@safe` function `main` calling `middle`
-fail_compilation/systemvariables_deprecation.d(20):        which calls `systemvariables_deprecation.inferred`
+fail_compilation/systemvariables_deprecation.d(20):        which calls `inferred`
 fail_compilation/systemvariables_deprecation.d(26):        and access `@system` variable `x0` makes it fail to infer `@safe`
 ---
 */
index d986dd65065f6cd9ec2bb8c94a5021155bff450e..a28284b9e478bfeccfbfac1fc44b52a12021649d 100644 (file)
@@ -2,7 +2,7 @@
 TEST_OUTPUT:
 ---
 fail_compilation/template_decl.d(8): Error: `{` expected after template parameter list, not `(`
-fail_compilation/template_decl.d(8): Error: declaration expected, not `(`
+fail_compilation/template_decl.d(8): Error: declaration expected, not `)`
 ---
 */
 template b(alias d)() {
index aeceb52cadc9b16453112c79b799ce0090ba5454..0f5bd707b8e13347beb9cf9885355e446b179e83 100644 (file)
@@ -1,7 +1,7 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/test1.d(8): Error: no identifier for declarator `fail`
+fail_compilation/test1.d(8): Error: variable name expected after type `fail`, not `End of File`
 ---
 */
 fail
index e1cd39c595af30ff4eb7018093b994e0680ff07f..4fcea9d7752630d2fbc9850e9cbbae959fe13a4d 100644 (file)
@@ -3,7 +3,7 @@
 ---
 fail_compilation/test14238.d(22): Error: scope parameter `fn` may not be returned
 fail_compilation/test14238.d(25): Error: function `test14238.bar` is `@nogc` yet allocates closure for `bar()` with the GC
-fail_compilation/test14238.d(27):        function `test14238.bar.baz` closes over variable `x`
+fail_compilation/test14238.d(27):        function `baz` closes over variable `x`
 fail_compilation/test14238.d(26):        `x` declared here
 ---
 */
index 1ad2126fd4319a3997f5bd05a7de012adcb69f05..c912d165a2dc2f2801d4301d915979a56c89512b 100644 (file)
@@ -2,7 +2,7 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/test14538.d(18): Error: cannot implicitly convert expression `x ? cast(uint)this.fCells[x].code : 32u` of type `uint` to `Cell`
+fail_compilation/test14538.d(18): Error: return value `x ? cast(uint)this.fCells[x].code : 32u` of type `uint` does not match return type `Cell`, and cannot be implicitly converted
 ---
 */
 
index 0bd052ca6db1bc40d86a53052cef07339b38cfd4..e3fedf34bd9213f29ba58c01699c760ef105cec3 100644 (file)
@@ -2,8 +2,8 @@
  * TEST_OUTPUT:
 ---
 fail_compilation/test16188.d(101): Error: no property `name` for `Where()` of type `test16188.Where`
-fail_compilation/test16188.d(101):        potentially malformed `opDispatch`. Use an explicit instantiation to get a better error message
-fail_compilation/test16188.d(103):        struct `Where` defined here
+fail_compilation/test16188.d(107): Error: undefined identifier `getMember`
+fail_compilation/test16188.d(101): Error: template instance `test16188.Where.opDispatch!"name"` error instantiating
 ---
  */
 
index 84dc7d1c6d75e7d42b1fa1cdb08989a1bda659b4..76a2fb66765ae24cf72383a9b518008872091a46 100644 (file)
@@ -3,7 +3,7 @@ REQUIRED_ARGS: -preview=dip1000
 TEST_OUTPUT:
 ---
 fail_compilation/test16193.d(39): Error: function `test16193.abc` is `@nogc` yet allocates closure for `abc()` with the GC
-fail_compilation/test16193.d(41):        delegate `test16193.abc.__foreachbody_L41_C5` closes over variable `x`
+fail_compilation/test16193.d(41):        delegate `int(int i) => 0` closes over variable `x`
 fail_compilation/test16193.d(40):        `x` declared here
 ---
 */
index 8bbfa82717f65c902a69379d7f1cc2d49584d8c5..e30dcf723d2f4d122dff86bac6e5fb0a308c0392 100644 (file)
@@ -4,7 +4,7 @@ TEST_OUTPUT:
 ---
 fail_compilation/test19107.d(24): Error: template `all` is not callable using argument types `!((c) => c)(string[])`
 fail_compilation/test19107.d(18):        Candidate is: `all(alias pred, T)(T t)`
-  with `pred = __lambda_L24_C15,
+  with `pred = (c) => c,
        T = string[]`
   must satisfy the following constraint:
 `       is(typeof(I!pred(t)))`
index b99afddbdd50ee94db786ee0afb75e53f5a0c1bb..1db134f03932d0c1f5b51646246c29859fadd50c 100644 (file)
@@ -3,7 +3,7 @@
 fail_compilation/test19971.d(16): Error: function `f` is not callable using argument types `(string)`
 fail_compilation/test19971.d(16):        cannot pass argument `"%s"` of type `string` to parameter `int x`
 fail_compilation/test19971.d(13):        `test19971.f(int x)` declared here
-fail_compilation/test19971.d(17): Error: function literal `__lambda_L17_C5(int x)` is not callable using argument types `(string)`
+fail_compilation/test19971.d(17): Error: function literal `(int x) { }` is not callable using argument types `(string)`
 fail_compilation/test19971.d(17):        cannot pass argument `"%s"` of type `string` to parameter `int x`
 ---
 */
index 5ab530737339f25cff8840a4edb20cdc8d15c605..18839cc3e2521ba22f3c76613dd2ccc70ad86d61 100644 (file)
@@ -1,11 +1,11 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/test21062.d(16): Error: no identifier for declarator `bool`
+fail_compilation/test21062.d(16): Error: variable name expected after type `bool`, not `synchronized`
 fail_compilation/test21062.d(16):        `synchronized` is a keyword, perhaps append `_` to make it an identifier
-fail_compilation/test21062.d(17): Error: no identifier for declarator `ubyte*`
+fail_compilation/test21062.d(17): Error: variable name expected after type `ubyte*`, not `out`
 fail_compilation/test21062.d(17):        `out` is a keyword, perhaps append `_` to make it an identifier
-fail_compilation/test21062.d(21): Error: no identifier for declarator `uint`
+fail_compilation/test21062.d(21): Error: variable name expected after type `uint`, not `in`
 fail_compilation/test21062.d(21):        `in` is a keyword, perhaps append `_` to make it an identifier
 ---
 */
index 302eb3da31a132ae18cc521f0587bcacb89871b2..169a9d1a5ca2e8723110485ab0bc53381e037e5d 100644 (file)
@@ -4,7 +4,7 @@
 TEST_OUTPUT:
 ---
 fail_compilation/test21096.d(11): Error: identifier or new keyword expected following `(...)`.
-fail_compilation/test21096.d(11): Error: no identifier for declarator `char[(__error)]`
+fail_compilation/test21096.d(11): Error: variable name expected after type `char[(__error)]`, not `;`
 ---
 */
 
index 7e236c8a33a226b7f2f69c61669da266f380fbe7..b34f60b68eda3701a85c690aea1d6a99bfa2fdbb 100644 (file)
@@ -3,16 +3,16 @@ PERMUTE_ARGS: -preview=dip1000
 TEST_OUTPUT:
 ---
 fail_compilation/test21912.d(28): Error: function `test21912.escapeParam` is `@nogc` yet allocates closure for `escapeParam()` with the GC
-fail_compilation/test21912.d(30):        delegate `test21912.escapeParam.__lambda_L30_C21` closes over variable `i`
+fail_compilation/test21912.d(30):        delegate `() => i` closes over variable `i`
 fail_compilation/test21912.d(28):        `i` declared here
 fail_compilation/test21912.d(33): Error: function `test21912.escapeAssign` is `@nogc` yet allocates closure for `escapeAssign()` with the GC
-fail_compilation/test21912.d(35):        delegate `test21912.escapeAssign.__lambda_L35_C10` closes over variable `i`
+fail_compilation/test21912.d(35):        delegate `() => i` closes over variable `i`
 fail_compilation/test21912.d(33):        `i` declared here
 fail_compilation/test21912.d(44): Error: function `test21912.escapeAssignRef` is `@nogc` yet allocates closure for `escapeAssignRef()` with the GC
-fail_compilation/test21912.d(46):        delegate `test21912.escapeAssignRef.__lambda_L46_C10` closes over variable `i`
+fail_compilation/test21912.d(46):        delegate `() => i` closes over variable `i`
 fail_compilation/test21912.d(44):        `i` declared here
 fail_compilation/test21912.d(55): Error: function `test21912.escapeParamInferred` is `@nogc` yet allocates closure for `escapeParamInferred()` with the GC
-fail_compilation/test21912.d(57):        delegate `test21912.escapeParamInferred.__lambda_L57_C29` closes over variable `i`
+fail_compilation/test21912.d(57):        delegate `() => i` closes over variable `i`
 fail_compilation/test21912.d(55):        `i` declared here
 ---
 */
index a0f553ba5bffbcd0aa90557e3864a024d55a5b34..95586c58ada99ee1e7533b10fa1935aec6027472 100644 (file)
@@ -1,7 +1,6 @@
 /* TEST_OUTPUT:
 ---
 fail_compilation/test22023.d(102): Error: typesafe variadic function parameter `a` of type `int[]` cannot be marked `return`
-fail_compilation/test22023.d(107): Error: typesafe variadic function parameter `c` of type `test22023.C` cannot be marked `return`
 ---
 */
 
@@ -14,13 +13,3 @@ ref int f(return int[] a ...)
 {
     return a[2];
 }
-
-ref int g(return C c ...)
-{
-    return c.x;
-}
-
-class C
-{
-    int x;
-}
index 5759415ead2fbbb5129bfbe944c20e921eabda4b..dcb745f9003a3adf33539952cd0bea9a808c8b07 100644 (file)
@@ -1,6 +1,7 @@
 /* REQUIRED_ARGS: -preview=dip1000
  * TEST_OUTPUT:
 ---
+fail_compilation/test22818.d(102): Deprecation: typesafe variadic parameters with a `class` type (`C c...`) are deprecated
 fail_compilation/test22818.d(104): Error: scope parameter `c` may not be returned
 ---
 */
index 9bbab80e48ce93a575fb6d270703c0c96aa0751c..9430c95c5bfac7a77dd146b0ce1771d46b9583df 100644 (file)
@@ -2,7 +2,7 @@
 TEST_OUTPUT:
 ---
 fail_compilation/test23112.d(106): Error: function `test23112.bar` is `@nogc` yet allocates closure for `bar()` with the GC
-fail_compilation/test23112.d(108):        function `test23112.bar.f` closes over variable `a`
+fail_compilation/test23112.d(108):        function `f` closes over variable `a`
 fail_compilation/test23112.d(106):        `a` declared here
 ---
 */
index bb6a71dcc240c2414fcb451e6e082fc86308de47..948df73603df8fbd6d181a10e6d9750946bccfc9 100644 (file)
@@ -5,7 +5,7 @@ TEST_OUTPUT:
 ---
 fail_compilation/imports/import23873.d(1): Error: (expression) expected following `static if`
 fail_compilation/imports/import23873.d(1): Error: declaration expected following attribute, not `;`
-fail_compilation/imports/import23873.d(3): Error: no identifier for declarator `x`
+fail_compilation/imports/import23873.d(3): Error: variable name expected after type `x`, not `End of File`
 ---
 */
 struct Foo
index 8a72ff116f8fbb4c95661829274afb475986304d..fbbde87c060f8d6f89d59d53dae237350e65cf4f 100644 (file)
@@ -1,7 +1,7 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/testInference.d(24): Error: cannot implicitly convert expression `this.a` of type `inout(A8998)` to `immutable(A8998)`
+fail_compilation/testInference.d(24): Error: return value `this.a` of type `inout(A8998)` does not match return type `immutable(A8998)`, and cannot be implicitly converted
 ---
 */
 
@@ -28,10 +28,10 @@ class C8998
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/testInference.d(39): Error: cannot implicitly convert expression `s` of type `const(char[])` to `string`
-fail_compilation/testInference.d(44): Error: cannot implicitly convert expression `a` of type `int[]` to `immutable(int[])`
-fail_compilation/testInference.d(49): Error: cannot implicitly convert expression `a` of type `int[]` to `immutable(int[])`
-fail_compilation/testInference.d(54): Error: cannot implicitly convert expression `a` of type `int[]` to `immutable(int[])`
+fail_compilation/testInference.d(39): Error: return value `s` of type `const(char[])` does not match return type `string`, and cannot be implicitly converted
+fail_compilation/testInference.d(44): Error: return value `a` of type `int[]` does not match return type `immutable(int[])`, and cannot be implicitly converted
+fail_compilation/testInference.d(49): Error: return value `a` of type `int[]` does not match return type `immutable(int[])`, and cannot be implicitly converted
+fail_compilation/testInference.d(54): Error: return value `a` of type `int[]` does not match return type `immutable(int[])`, and cannot be implicitly converted
 ---
 */
 string foo(in char[] s) pure
@@ -58,18 +58,18 @@ immutable(int[]) x3(immutable(int[]) org) /*pure*/
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/testInference.d(94): Error: cannot implicitly convert expression `c` of type `testInference.C1` to `immutable(C1)`
-fail_compilation/testInference.d(95): Error: cannot implicitly convert expression `c` of type `testInference.C1` to `immutable(C1)`
-fail_compilation/testInference.d(96): Error: cannot implicitly convert expression `c` of type `testInference.C3` to `immutable(C3)`
-fail_compilation/testInference.d(97): Error: cannot implicitly convert expression `c` of type `testInference.C3` to `immutable(C3)`
+fail_compilation/testInference.d(94): Error: return value `c` of type `testInference.C1` does not match return type `immutable(C1)`, and cannot be implicitly converted
+fail_compilation/testInference.d(95): Error: return value `c` of type `testInference.C1` does not match return type `immutable(C1)`, and cannot be implicitly converted
+fail_compilation/testInference.d(96): Error: return value `c` of type `testInference.C3` does not match return type `immutable(C3)`, and cannot be implicitly converted
+fail_compilation/testInference.d(97): Error: return value `c` of type `testInference.C3` does not match return type `immutable(C3)`, and cannot be implicitly converted
 fail_compilation/testInference.d(100): Error: undefined identifier `X1`, did you mean function `x1`?
-fail_compilation/testInference.d(106): Error: cannot implicitly convert expression `s` of type `S1` to `immutable(S1)`
-fail_compilation/testInference.d(109): Error: cannot implicitly convert expression `a` of type `int*[]` to `immutable(int*[])`
-fail_compilation/testInference.d(110): Error: cannot implicitly convert expression `a` of type `const(int)*[]` to `immutable(int*[])`
-fail_compilation/testInference.d(114): Error: cannot implicitly convert expression `s` of type `S2` to `immutable(S2)`
-fail_compilation/testInference.d(115): Error: cannot implicitly convert expression `s` of type `S2` to `immutable(S2)`
-fail_compilation/testInference.d(116): Error: cannot implicitly convert expression `s` of type `S2` to `immutable(S2)`
-fail_compilation/testInference.d(118): Error: cannot implicitly convert expression `a` of type `const(int)*[]` to `immutable(int*[])`
+fail_compilation/testInference.d(106): Error: return value `s` of type `S1` does not match return type `immutable(S1)`, and cannot be implicitly converted
+fail_compilation/testInference.d(109): Error: return value `a` of type `int*[]` does not match return type `immutable(int*[])`, and cannot be implicitly converted
+fail_compilation/testInference.d(110): Error: return value `a` of type `const(int)*[]` does not match return type `immutable(int*[])`, and cannot be implicitly converted
+fail_compilation/testInference.d(114): Error: return value `s` of type `S2` does not match return type `immutable(S2)`, and cannot be implicitly converted
+fail_compilation/testInference.d(115): Error: return value `s` of type `S2` does not match return type `immutable(S2)`, and cannot be implicitly converted
+fail_compilation/testInference.d(116): Error: return value `s` of type `S2` does not match return type `immutable(S2)`, and cannot be implicitly converted
+fail_compilation/testInference.d(118): Error: return value `a` of type `const(int)*[]` does not match return type `immutable(int*[])`, and cannot be implicitly converted
 ---
 */
 immutable(Object) get(inout int*) pure
@@ -122,7 +122,7 @@ immutable(int*[]) bar2c(              S2 prm) pure { immutable(int)*[] a; return
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/testInference.d(134): Error: cannot implicitly convert expression `f10063(cast(inout(void*))p)` of type `inout(void)*` to `immutable(void)*`
+fail_compilation/testInference.d(134): Error: return value `f10063(cast(inout(void*))p)` of type `inout(void)*` does not match return type `immutable(void)*`, and cannot be implicitly converted
 ---
 */
 inout(void)* f10063(inout void* p) pure
@@ -138,8 +138,8 @@ immutable(void)* g10063(inout int* p) pure
 TEST_OUTPUT:
 ---
 fail_compilation/testInference.d(154): Error: `pure` function `testInference.bar14049` cannot call impure function `testInference.foo14049!int.foo14049`
-fail_compilation/testInference.d(149):        which calls `testInference.foo14049!int.foo14049.__lambda_L147_C14`
-fail_compilation/testInference.d(148):        which calls `testInference.impure14049`
+fail_compilation/testInference.d(149):        which calls `() => impure14049()`
+fail_compilation/testInference.d(148):        which calls `impure14049`
 fail_compilation/testInference.d(143):        and accessing mutable static data `i` makes it fail to infer `pure`
 ---
 */
@@ -174,7 +174,7 @@ int* f14160() pure
 TEST_OUTPUT:
 ---
 fail_compilation/testInference.d(180): Error: `pure` function `testInference.test12422` cannot call impure function `testInference.test12422.bar12422!().bar12422`
-fail_compilation/testInference.d(179):        which calls `testInference.foo12422`
+fail_compilation/testInference.d(179):        which calls `foo12422`
 ---
 */
 #line 175
@@ -239,7 +239,7 @@ void test17086_call ()
 TEST_OUTPUT:
 ---
 fail_compilation/testInference.d(238): Error: `pure` function `testInference.test20047_pure_function` cannot call impure function `testInference.test20047_pure_function.bug`
-fail_compilation/testInference.d(237):        which calls `testInference.test20047_impure_function`
+fail_compilation/testInference.d(237):        which calls `test20047_impure_function`
 ---
 */
 #line 234
index 77601a5e4465d3080d57ee1558dbd21074b7245c..71f2cd1a78e6e48d04eb8c2449a4c38409f74907 100644 (file)
@@ -1,11 +1,11 @@
 /* TEST_OUTPUT:
 ---
 fail_compilation/testsemi.d(102): Error: found `int` when expecting `;` following static assert
-fail_compilation/testsemi.d(102): Error: no identifier for declarator `x`
+fail_compilation/testsemi.d(102): Error: variable name expected after type `x`, not `;`
 fail_compilation/testsemi.d(109): Error: found `alias` when expecting `;` following alias reassignment
 fail_compilation/testsemi.d(112): Error: found `}` when expecting `;` following invariant
 fail_compilation/testsemi.d(117): Error: found `int` when expecting `;` following `alias Identifier this`
-fail_compilation/testsemi.d(117): Error: no identifier for declarator `x`
+fail_compilation/testsemi.d(117): Error: variable name expected after type `x`, not `;`
 fail_compilation/testsemi.d(123): Error: found `int` when expecting `;` following mixin
 fail_compilation/testsemi.d(129): Error: found `int` when expecting `;` following `import` Expression
 fail_compilation/testsemi.d(131): Error: `}` expected following members in `class` declaration
index 66062fdab69c29cb8485ad9d858eaaa70c954d9f..eb0b396af49ac3918558d3a32b7e5f0419e26b2c 100644 (file)
@@ -3,7 +3,7 @@ TEST_OUTPUT:
 ---
 fail_compilation/traits_alone.d(11): Error: found `End of File` when expecting `(`
 fail_compilation/traits_alone.d(11): Error: `__traits(identifier, args...)` expected
-fail_compilation/traits_alone.d(11): Error: no identifier for declarator `$r:_?_error_?$`
+fail_compilation/traits_alone.d(11): Error: variable name expected after type `$r:_?_error_?$`, not `End of File`
 ---
 */
 //used to segfault
index 76df55fcfd72a2c5a92784eb02b190db75eb85ff..06f4bd8b67b384218626b612ddaf0c70ec8b5fa8 100644 (file)
@@ -15,19 +15,19 @@ fail_compilation/udaparams.d(45): Error: `@nogc` attribute for function paramete
 fail_compilation/udaparams.d(51): Error: cannot put a storage-class in an `alias` declaration.
 fail_compilation/udaparams.d(52): Error: cannot put a storage-class in an `alias` declaration.
 fail_compilation/udaparams.d(53): Error: semicolon expected to close `alias` declaration, not `=>`
-fail_compilation/udaparams.d(53): Error: declaration expected, not `=>`
+fail_compilation/udaparams.d(53): Error: declaration expected, not `1`
 fail_compilation/udaparams.d(54): Error: semicolon expected to close `alias` declaration, not `=>`
-fail_compilation/udaparams.d(54): Error: declaration expected, not `=>`
+fail_compilation/udaparams.d(54): Error: declaration expected, not `1`
 fail_compilation/udaparams.d(57): Error: basic type expected, not `@`
 fail_compilation/udaparams.d(57): Error: identifier expected for template value parameter
 fail_compilation/udaparams.d(57): Error: found `@` when expecting `)`
 fail_compilation/udaparams.d(57): Error: basic type expected, not `3`
 fail_compilation/udaparams.d(57): Error: found `3` when expecting `)`
 fail_compilation/udaparams.d(57): Error: semicolon expected following function declaration, not `)`
+fail_compilation/udaparams.d(57): Error: variable name expected after type `T`, not `)`
 fail_compilation/udaparams.d(57): Error: declaration expected, not `)`
 ---
 */
-
 void vararg1(int a, @(10) ...);
 extern(C) void vararg2(int a, @(10) ...);
 
index 0753b13f31857dd5817076e382de2a860e6d470b..514a86a284cd63b809df47b21edaf65131e28b7a 100644 (file)
@@ -1,7 +1,7 @@
 /*
 TEST_OUTPUT:
 ---
-fail_compilation/var_func_attr.d(19): Error: cannot implicitly convert expression `__lambda_L19_C27` of type `void function() nothrow @nogc @safe` to `void function() pure`
+fail_compilation/var_func_attr.d(19): Error: cannot implicitly convert expression `() { static int g; g++; }` of type `void function() nothrow @nogc @safe` to `void function() pure`
 ---
 */
 
index ba8ceecc55c35e44ad5186b8971d352d9be033e5..e1abcb4418c5a4a6768f31099825a2a0ebd645f4 100644 (file)
@@ -286,6 +286,27 @@ struct PropertyTable10106
     CodepointSet10106[string] table;
 }
 
+/************************************************/
+// strip inout in key and value types
+void testinout()
+{
+    inout(long) func1(inout(long[][int]) aa)
+    {
+        return aa[0][0];
+    }
+    long[][int] a = [ 0 : [42] ];
+    long b = func1(a);
+    assert(b == 42);
+}
+
+/************************************************/
+// type info generated for enum creation in InExp?
+void testinenum()
+{
+    enum string[string] aa = [ "one" : "un", "two" : "deux" ];
+    assert("one" in aa);
+}
+
 /************************************************/
 
 int main()
@@ -295,6 +316,8 @@ int main()
     test4523();
     test3825();
     test3825x();
+    testinout();
+    testinenum();
 
     printf("Success\n");
     return 0;
index d146fd49dbf47197ef9eae68883e22059978b4c8..51a95a08a61da4b633e25d1d66f85c3c4a8db90e 100644 (file)
@@ -83,39 +83,6 @@ void test3()
     printf("%d\n", i);
 }
 
-/*********************************************************/
-
-class Foo4
-{
-    int a;
-    float f;
-    double d;
-
-    this(int a, float f, double d)
-    {
-        this.a = a;
-        this.f = f;
-        this.d = d;
-    }
-}
-
-int sum4(Foo4 f ...)
-{
-    return cast(int)(f.a + f.f + f.d);
-}
-
-void test4()
-{
-    int i;
-    Foo4 foo = new Foo4(1, 2f, 3.0);
-
-    i = sum4(foo);
-    assert(i == 1+2+3);
-    i = sum4(4, 5f, 6.0);
-    assert(i == 4+5+6);
-
-    printf("%d\n", i);
-}
 
 /*********************************************************/
 
@@ -139,7 +106,6 @@ int main()
     test1();
     test2();
     test3();
-    test4();
     test5();
 
     printf("Success\n");
index 59d5a18481001abde457b91b2c4abd9ab5b183fd..66cfdd6ad4ac977922fed28fbfeadd5e7800ced0 100644 (file)
@@ -1,4 +1,4 @@
-ffbad272b649b7ae3e88cfdc85688bfef3168994
+53a1cc8d13e8db2cb1642219320a8dfc1b0cc6c5
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/dmd repository.
index ba34727a3051ceab51501a4fbdfaed557ecb9925..1b2b78ea5707c9db16e8e25c2202f243ae3dd22b 100644 (file)
@@ -52,7 +52,7 @@ version (D_ProfileGC)
     /**
      * TraceGC wrapper around $(REF _d_arrayappendT, core,internal,array,appending).
      */
-    ref Tarr _d_arrayappendcTXTrace(Tarr : T[], T)(string file, int line, string funcname, return ref scope Tarr px, size_t n) @trusted
+    ref Tarr _d_arrayappendcTXTrace(Tarr : T[], T)(return ref scope Tarr px, size_t n, string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trusted
     {
         version (D_TypeInfo)
         {
@@ -115,7 +115,7 @@ version (D_ProfileGC)
     /**
      * TraceGC wrapper around $(REF _d_arrayappendT, core,internal,array,appending).
      */
-    ref Tarr _d_arrayappendTTrace(Tarr : T[], T)(string file, int line, string funcname, return ref scope Tarr x, scope Tarr y) @trusted
+    ref Tarr _d_arrayappendTTrace(Tarr : T[], T)(return ref scope Tarr x, scope Tarr y, string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trusted
     {
         version (D_TypeInfo)
         {
index 3063c4c0ea063ac02c65e7e0b3a0e6aed230f1fa..13ec5fad40fde63125e69c9064fc533d000a890f 100644 (file)
@@ -48,7 +48,7 @@ Tret _d_arraycatnTX(Tret, Tarr...)(auto ref Tarr froms) @trusted
     {
         // TODO: forward file, line, name from _d_arraycatnTXTrace
         _d_arraysetlengthTImpl!(typeof(res))._d_arraysetlengthTTrace(
-            __FILE__, __LINE__, "_d_arraycatnTX", res, totalLen);
+            res, totalLen, __FILE__, __LINE__, __FUNCTION__);
     }
     else
     {
@@ -178,7 +178,7 @@ version (D_ProfileGC)
     /**
     * TraceGC wrapper around $(REF _d_arraycatnTX, core,internal,array,concatenation).
     */
-    Tret _d_arraycatnTXTrace(Tret, Tarr...)(string file, int line, string funcname, scope auto ref Tarr froms) @trusted
+    Tret _d_arraycatnTXTrace(Tret, Tarr...)(scope auto ref Tarr froms, string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trusted
     {
         version (D_TypeInfo)
         {
index 45a1ce5629ddfcd4238df7356a5fc9810489fc84..40e5a61bbded04564309ae6fe171ac9701c47710 100644 (file)
@@ -470,7 +470,7 @@ version (D_ProfileGC)
     /**
     * TraceGC wrapper around $(REF _d_newitemT, core,lifetime).
     */
-    T[] _d_newarrayTTrace(T)(string file, int line, string funcname, size_t length, bool isShared) @trusted
+    T[] _d_newarrayTTrace(T)(size_t length, bool isShared, string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trusted
     {
         version (D_TypeInfo)
         {
@@ -602,7 +602,7 @@ version (D_ProfileGC)
     /**
     * TraceGC wrapper around $(REF _d_newarraymT, core,internal,array,construction).
     */
-    Tarr _d_newarraymTXTrace(Tarr : U[], T, U)(string file, int line, string funcname, size_t[] dims, bool isShared=false) @trusted
+    Tarr _d_newarraymTXTrace(Tarr : U[], T, U)(size_t[] dims, bool isShared=false, string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trusted
     {
         version (D_TypeInfo)
         {
index 2cda571ba71949cee511cab3e63c93787ce2b1f2..deaae3f95da63d7611c872acdcd2dadb4a6debbd 100644 (file)
@@ -53,18 +53,6 @@ version (D_ProfileGC)
             string name = } ~ "`" ~ Type ~ "`;" ~ q{
 
             // FIXME: use rt.tracegc.accumulator when it is accessable in the future.
-            version (tracegc)
-        } ~ "{\n" ~ q{
-                import core.stdc.stdio : printf;
-
-                printf("%sTrace file = '%.*s' line = %d function = '%.*s' type = %.*s\n",
-                } ~ "\"" ~ Hook ~ "\".ptr," ~ q{
-                    file.length, file.ptr,
-                    line,
-                    funcname.length, funcname.ptr,
-                    name.length, name.ptr
-                );
-            } ~ "}\n" ~ q{
             ulong currentlyAllocated = gcStatsPure().allocatedInCurrentThread;
 
             scope(exit)
@@ -99,7 +87,7 @@ version (D_ProfileGC)
      *  purity, and throwabilty checks. To prevent breaking existing code, this function template
      *  is temporarily declared `@trusted pure` until the implementation can be brought up to modern D expectations.
     */
-    auto _d_HookTraceImpl(T, alias Hook, string errorMessage)(string file, int line, string funcname, Parameters!Hook parameters) @trusted pure
+    auto _d_HookTraceImpl(T, alias Hook, string errorMessage)(Parameters!Hook parameters, string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trusted pure
     {
         version (D_TypeInfo)
         {
index 7c858f33522ceaade006076c39350a20ed660f4f..47283f28030191a8faff97683c9e1675532e87e7 100644 (file)
@@ -44,7 +44,7 @@ struct Impl
     Bucket[] buckets;
     uint used;
     uint deleted;
-    TypeInfo_Struct entryTI;
+    const(TypeInfo) entryTI;
     uint firstUsed;
     immutable uint keysz;
     immutable uint valsz;
@@ -75,15 +75,6 @@ private size_t mix(size_t h) @safe pure nothrow @nogc
     return h;
 }
 
-struct Entry(K, V)
-{
-    // can make this const, because we aren't really going to use it aside from
-    // construction.
-    const K key;
-    V value;
-}
-
-
 // create a binary-compatible AA structure that can be used directly as an
 // associative array.
 // NOTE: this must only be called during CTFE
@@ -92,7 +83,7 @@ AAShell makeAA(K, V)(V[K] src) @trusted
     assert(__ctfe, "makeAA Must only be called at compile time");
     immutable srclen = src.length;
     assert(srclen <= uint.max);
-    alias E = Entry!(K, V);
+    alias E = TypeInfo_AssociativeArray.Entry!(K, V);
     if (srclen == 0)
         return AAShell.init;
     // first, determine the size that would be used if we grew the bucket list
index a088bf6ca2d8ce77226b4b1282451e1bf66e30f5..49512ab14b476e058ca937156bcdb58775da3d52 100644 (file)
@@ -2788,7 +2788,7 @@ if (is(T == class))
 /**
  * TraceGC wrapper around $(REF _d_newclassT, core,lifetime).
  */
-T _d_newclassTTrace(T)(string file, int line, string funcname) @trusted
+T _d_newclassTTrace(T)(string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trusted
 {
     version (D_TypeInfo)
     {
@@ -2985,7 +2985,7 @@ version (D_ProfileGC)
     /**
     * TraceGC wrapper around $(REF _d_newitemT, core,lifetime).
     */
-    T* _d_newitemTTrace(T)(string file, int line, string funcname) @trusted
+    T* _d_newitemTTrace(T)(string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trusted
     {
         version (D_TypeInfo)
         {
index c95fe6514070d9f582aac75a42cad37c5aa0553a..34f78e03e4a778123733a483bea43d72c76e6e8d 100644 (file)
@@ -670,3 +670,8 @@ package(core) template muslRedirTime64Mangle(string name, string redirectedName)
     else
         enum muslRedirTime64Mangle = name;
 }
+
+version (PPC64)
+    enum PPCUseIEEE128 = real.mant_dig == 113;
+else
+    enum PPCUseIEEE128 = false;
index e54d5813995daf749a9f53fc21f4b2e190b5ba8a..1f384f9cbd46b7fd5c79c151d377f3fbf4bdfc78 100644 (file)
@@ -4284,404 +4284,651 @@ else
     double  acos(double x);
     ///
     float   acosf(float x);
-    ///
-    real    acosl(real x);
 
     ///
     double  asin(double x);
     ///
     float   asinf(float x);
-    ///
-    real    asinl(real x);
 
     ///
     pure double  atan(double x);
     ///
     pure float   atanf(float x);
-    ///
-    pure real    atanl(real x);
 
     ///
     double  atan2(double y, double x);
     ///
     float   atan2f(float y, float x);
-    ///
-    real    atan2l(real y, real x);
 
     ///
     pure double  cos(double x);
     ///
     pure float   cosf(float x);
-    ///
-    pure real    cosl(real x);
 
     ///
     pure double  sin(double x);
     ///
     pure float   sinf(float x);
-    ///
-    pure real    sinl(real x);
 
     ///
     pure double  tan(double x);
     ///
     pure float   tanf(float x);
-    ///
-    pure real    tanl(real x);
 
     ///
     double  acosh(double x);
     ///
     float   acoshf(float x);
-    ///
-    real    acoshl(real x);
 
     ///
     pure double  asinh(double x);
     ///
     pure float   asinhf(float x);
-    ///
-    pure real    asinhl(real x);
 
     ///
     double  atanh(double x);
     ///
     float   atanhf(float x);
-    ///
-    real    atanhl(real x);
 
     ///
     double  cosh(double x);
     ///
     float   coshf(float x);
-    ///
-    real    coshl(real x);
 
     ///
     double  sinh(double x);
     ///
     float   sinhf(float x);
-    ///
-    real    sinhl(real x);
 
     ///
     pure double  tanh(double x);
     ///
     pure float   tanhf(float x);
-    ///
-    pure real    tanhl(real x);
 
     ///
     double  exp(double x);
     ///
     float   expf(float x);
-    ///
-    real    expl(real x);
 
     ///
     double  exp2(double x);
     ///
     float   exp2f(float x);
-    ///
-    real    exp2l(real x);
 
     ///
     double  expm1(double x);
     ///
     float   expm1f(float x);
-    ///
-    real    expm1l(real x);
 
     ///
     pure double  frexp(double value, int* exp);
     ///
     pure float   frexpf(float value, int* exp);
-    ///
-    pure real    frexpl(real value, int* exp);
 
     ///
     int     ilogb(double x);
     ///
     int     ilogbf(float x);
-    ///
-    int     ilogbl(real x);
 
     ///
     double  ldexp(double x, int exp);
     ///
     float   ldexpf(float x, int exp);
-    ///
-    real    ldexpl(real x, int exp);
 
     ///
     double  log(double x);
     ///
     float   logf(float x);
-    ///
-    real    logl(real x);
 
     ///
     double  log10(double x);
     ///
     float   log10f(float x);
-    ///
-    real    log10l(real x);
 
     ///
     double  log1p(double x);
     ///
     float   log1pf(float x);
-    ///
-    real    log1pl(real x);
 
     ///
     double  log2(double x);
     ///
     float   log2f(float x);
-    ///
-    real    log2l(real x);
 
     ///
     double  logb(double x);
     ///
     float   logbf(float x);
-    ///
-    real    logbl(real x);
 
     ///
     pure double  modf(double value, double* iptr);
     ///
     pure float   modff(float value, float* iptr);
-    ///
-    pure real    modfl(real value, real *iptr);
 
     ///
     double  scalbn(double x, int n);
     ///
     float   scalbnf(float x, int n);
-    ///
-    real    scalbnl(real x, int n);
 
     ///
     double  scalbln(double x, c_long n);
     ///
     float   scalblnf(float x, c_long n);
-    ///
-    real    scalblnl(real x, c_long n);
 
     ///
     pure double  cbrt(double x);
     ///
     pure float   cbrtf(float x);
-    ///
-    pure real    cbrtl(real x);
 
     ///
     pure double  fabs(double x);
-    version (CRuntime_Microsoft)
-    {
-    }
-    else
-    {
-        ///
-        pure float   fabsf(float x);
-        ///
-        pure real    fabsl(real x);
-    }
 
     ///
     double  hypot(double x, double y);
     ///
     float   hypotf(float x, float y);
-    ///
-    real    hypotl(real x, real y);
 
     ///
     double  pow(double x, double y);
     ///
     float   powf(float x, float y);
-    ///
-    real    powl(real x, real y);
 
     ///
     double  sqrt(double x);
     ///
     float   sqrtf(float x);
-    ///
-    real    sqrtl(real x);
 
     ///
     pure double  erf(double x);
     ///
     pure float   erff(float x);
-    ///
-    pure real    erfl(real x);
 
     ///
     double  erfc(double x);
     ///
     float   erfcf(float x);
-    ///
-    real    erfcl(real x);
 
     ///
     double  lgamma(double x);
     ///
     float   lgammaf(float x);
-    ///
-    real    lgammal(real x);
 
     ///
     double  tgamma(double x);
     ///
     float   tgammaf(float x);
-    ///
-    real    tgammal(real x);
 
     ///
     pure double  ceil(double x);
     ///
     pure float   ceilf(float x);
-    ///
-    pure real    ceill(real x);
 
     ///
     pure double  floor(double x);
     ///
     pure float   floorf(float x);
-    ///
-    pure real    floorl(real x);
 
     ///
     pure double  nearbyint(double x);
     ///
     pure float   nearbyintf(float x);
-    ///
-    pure real    nearbyintl(real x);
 
     ///
     pure double  rint(double x);
     ///
     pure float   rintf(float x);
-    ///
-    pure real    rintl(real x);
 
     ///
     c_long  lrint(double x);
     ///
     c_long  lrintf(float x);
-    ///
-    c_long  lrintl(real x);
 
     ///
     long    llrint(double x);
     ///
     long    llrintf(float x);
-    ///
-    long    llrintl(real x);
 
     ///
     pure double  round(double x);
     ///
     pure float   roundf(float x);
-    ///
-    pure real    roundl(real x);
 
     ///
     c_long  lround(double x);
     ///
     c_long  lroundf(float x);
-    ///
-    c_long  lroundl(real x);
 
     ///
     long    llround(double x);
     ///
     long    llroundf(float x);
-    ///
-    long    llroundl(real x);
 
     ///
     pure double  trunc(double x);
     ///
     pure float   truncf(float x);
-    ///
-    pure real    truncl(real x);
 
     ///
     double  fmod(double x, double y);
     ///
     float   fmodf(float x, float y);
-    ///
-    real    fmodl(real x, real y);
 
     ///
     double  remainder(double x, double y);
     ///
     float   remainderf(float x, float y);
-    ///
-    real    remainderl(real x, real y);
 
     ///
     double  remquo(double x, double y, int* quo);
     ///
     float   remquof(float x, float y, int* quo);
-    ///
-    real    remquol(real x, real y, int* quo);
 
     ///
     pure double  copysign(double x, double y);
     ///
     pure float   copysignf(float x, float y);
-    ///
-    pure real    copysignl(real x, real y);
 
     ///
     pure double  nan(char* tagp);
     ///
     pure float   nanf(char* tagp);
-    ///
-    pure real    nanl(char* tagp);
 
     ///
     double  nextafter(double x, double y);
     ///
     float   nextafterf(float x, float y);
     ///
-    real    nextafterl(real x, real y);
-
-    ///
-    double  nexttoward(double x, real y);
-    ///
-    float   nexttowardf(float x, real y);
-    ///
-    real    nexttowardl(real x, real y);
 
     ///
     double  fdim(double x, double y);
     ///
     float   fdimf(float x, float y);
-    ///
-    real    fdiml(real x, real y);
 
     ///
     pure double  fmax(double x, double y);
     ///
     pure float   fmaxf(float x, float y);
-    ///
-    pure real    fmaxl(real x, real y);
+
 
     ///
     pure double  fmin(double x, double y);
     ///
     pure float   fminf(float x, float y);
-    ///
-    pure real    fminl(real x, real y);
+
 
     ///
     pure double  fma(double x, double y, double z);
     ///
     pure float   fmaf(float x, float y, float z);
-    ///
-    pure real    fmal(real x, real y, real z);
+
+
+    static if (PPCUseIEEE128) {
+        ///
+        real    __acosieee128(real x);
+        ///
+        alias acosl = __acosieee128;
+        ///
+        real    __asinieee128(real x);
+        ///
+        alias asinl = __asinieee128;
+        ///
+        pure real    __atanieee128(real x);
+        ///
+        alias atanl = __atanieee128;
+        ///
+        real    __atan2ieee128(real y, real x);
+        ///
+        alias atan2l = __atan2ieee128;
+        ///
+        pure real    __cosieee128(real x);
+        ///
+        alias cosl = __cosieee128;
+        ///
+        pure real    __sinieee128(real x);
+        ///
+        alias sinl = __sinieee128;
+        ///
+        pure real    __tanieee128(real x);
+        ///
+        alias tanl = __tanieee128;
+        ///
+        real    __acoshieee128(real x);
+        ///
+        alias acoshl = __acoshieee128;
+        ///
+        pure real    __asinhieee128(real x);
+        ///
+        alias asinhl = __asinhieee128;
+        ///
+        real    __atanhieee128(real x);
+        ///
+        alias atanhl = __atanhieee128;
+        ///
+        real    __coshieee128(real x);
+        ///
+        alias coshl = __coshieee128;
+        ///
+        real    __sinhieee128(real x);
+        ///
+        alias sinhl = __sinhieee128;
+        ///
+        pure real    __tanhieee128(real x);
+        ///
+        alias tanhl = __tanhieee128;
+        ///
+        real    __expieee128(real x);
+        ///
+        alias expl = __expieee128;
+        ///
+        real    __exp2ieee128(real x);
+        ///
+        alias exp2l = __exp2ieee128;
+        ///
+        real    __expm1ieee128(real x);
+        ///
+        alias expm1l = __expm1ieee128;
+        ///
+        pure real    __frexpieee128(real value, int* exp);
+        ///
+        alias frexpl = __frexpieee128;
+        ///
+        int     __ilogbieee128(real x);
+        ///
+        alias ilogbl = __ilogbieee128;
+        ///
+        real    __ldexpieee128(real x, int exp);
+        ///
+        alias ldexpl = __ldexpieee128;
+        ///
+        real    __logieee128(real x);
+        ///
+        alias logl = __logieee128;
+        ///
+        real    __log10ieee128(real x);
+        ///
+        alias log10l = __log10ieee128;
+        ///
+        real    __log1pieee128(real x);
+        ///
+        alias log1pl = __log1pieee128;
+        ///
+        real    __log2ieee128(real x);
+        ///
+        alias log2l = __log2ieee128;
+        ///
+        real    __logbieee128(real x);
+        ///
+        alias logbl = __logbieee128;
+        ///
+        pure real    __modfieee128(real value, real *iptr);
+        ///
+        alias modfl = __modfieee128;
+        ///
+        real    __scalbnieee128(real x, int n);
+        ///
+        alias scalbnl = __scalbnieee128;
+        ///
+        real    __scalblnieee128(real x, c_long n);
+        ///
+        alias scalblnl = __scalblnieee128;
+        ///
+        pure real    __cbrtieee128(real x);
+        ///
+        alias cbrtl = __cbrtieee128;
+        ///
+        pure float   fabsf(float x);
+        ///
+        pure real    __fabsieee128(real x);
+        ///
+        alias fabsl = __fabsieee128;
+        ///
+        real    __hypotieee128(real x, real y);
+        ///
+        alias hypotl = __hypotieee128;
+        ///
+        real    __powieee128(real x, real y);
+        ///
+        alias powl = __powieee128;
+        ///
+        real    __sqrtieee128(real x);
+        ///
+        alias sqrtl = __sqrtieee128;
+        ///
+        pure real    __erfieee128(real x);
+        ///
+        alias erfl = __erfieee128;
+        ///
+        real    __erfcieee128(real x);
+        ///
+        alias erfcl = __erfcieee128;
+        ///
+        real    __lgammaieee128(real x);
+        ///
+        alias lgammal = __lgammaieee128;
+        ///
+        real    __tgammaieee128(real x);
+        ///
+        alias tgammal = __tgammaieee128;
+        ///
+        pure real    __ceilieee128(real x);
+        ///
+        alias ceill = __ceilieee128;
+        ///
+        pure real    __floorieee128(real x);
+        ///
+        alias floorl = __floorieee128;
+        ///
+        pure real    __nearbyintieee128(real x);
+        ///
+        alias nearbyintl = __nearbyintieee128;
+        ///
+        pure real    __rintieee128(real x);
+        ///
+        alias rintl = __rintieee128;
+        ///
+        c_long  __lrintieee128(real x);
+        ///
+        alias lrintl = __lrintieee128;
+        ///
+        long    __llrintieee128(real x);
+        ///
+        alias llrintl = __llrintieee128;
+        ///
+        pure real    __roundieee128(real x);
+        ///
+        alias roundl = __roundieee128;
+        ///
+        c_long  __lroundieee128(real x);
+        ///
+        alias lroundl = __lroundieee128;
+        ///
+        long    __llroundieee128(real x);
+        ///
+        alias llroundl = __llroundieee128;
+        ///
+        pure real    __truncieee128(real x);
+        ///
+        alias truncl = __truncieee128;
+        ///
+        real    __fmodieee128(real x, real y);
+        ///
+        alias fmodl = __fmodieee128;
+        ///
+        real    __remainderieee128(real x, real y);
+        ///
+        alias remainderl = __remainderieee128;
+        ///
+        real    __remquoieee128(real x, real y, int* quo);
+        ///
+        alias remquol = __remquoieee128;
+        ///
+        pure real    __copysignieee128(real x, real y);
+        ///
+        alias copysignl = __copysignieee128;
+        ///
+        pure real    __nanieee128(char* tagp);
+        ///
+        alias nanl = __nanieee128;
+        ///
+        real    __nextafterieee128(real x, real y);
+        ///
+        alias nextafterl = __nextafterieee128;
+        ///
+        double  __nexttoward_to_ieee128(double x, real y);
+        ///
+        alias nexttoward = __nexttoward_to_ieee128;
+        ///
+        float   __nexttowardf_to_ieee128(float x, real y);
+        ///
+        alias nexttowardf = __nexttowardf_to_ieee128;
+        ///
+        real    __nexttowardieee128(real x, real y);
+        ///
+        alias nexttowardl = __nexttowardieee128;
+        ///
+        real    __fdimieee128(real x, real y);
+        ///
+        alias fdiml = __fdimieee128;
+        ///
+        pure real    __fmaxieee128(real x, real y);
+        ///
+        alias fmaxl = __fmaxieee128;
+        ///
+        pure real    __fminieee128(real x, real y);
+        ///
+        alias fminl = __fminieee128;
+        ///
+        pure real    __fmaieee128(real x, real y, real z);
+        ///
+        alias fmal = __fmaieee128;
+    }
+    else
+    {
+        ///
+        real    acosl(real x);
+        ///
+        real    asinl(real x);
+        ///
+        pure real    atanl(real x);
+        ///
+        real    atan2l(real y, real x);
+        ///
+        pure real    cosl(real x);
+        ///
+        pure real    sinl(real x);
+        ///
+        pure real    tanl(real x);
+        ///
+        real    acoshl(real x);
+        ///
+        pure real    asinhl(real x);
+        ///
+        real    atanhl(real x);
+        ///
+        real    coshl(real x);
+        ///
+        real    sinhl(real x);
+        ///
+        pure real    tanhl(real x);
+        ///
+        real    expl(real x);
+        ///
+        real    exp2l(real x);
+        ///
+        real    expm1l(real x);
+        ///
+        pure real    frexpl(real value, int* exp);
+        ///
+        int     ilogbl(real x);
+        ///
+        real    ldexpl(real x, int exp);
+        ///
+        real    logl(real x);
+        ///
+        real    log10l(real x);
+        ///
+        real    log1pl(real x);
+        ///
+        real    log2l(real x);
+        ///
+        real    logbl(real x);
+        ///
+        pure real    modfl(real value, real *iptr);
+        ///
+        real    scalbnl(real x, int n);
+        ///
+        real    scalblnl(real x, c_long n);
+        ///
+        pure real    cbrtl(real x);
+        version (CRuntime_Microsoft)
+        {
+        }
+        else
+        {
+            ///
+            pure float   fabsf(float x);
+            ///
+            pure real    fabsl(real x);
+        }
+        ///
+        real    hypotl(real x, real y);
+        ///
+        real    powl(real x, real y);
+        ///
+        real    sqrtl(real x);
+        ///
+        pure real    erfl(real x);
+        ///
+        real    erfcl(real x);
+        ///
+        real    lgammal(real x);
+        ///
+        real    tgammal(real x);
+        ///
+        pure real    ceill(real x);
+        ///
+        pure real    floorl(real x);
+        ///
+        pure real    nearbyintl(real x);
+        ///
+        pure real    rintl(real x);
+        ///
+        c_long  lrintl(real x);
+        ///
+        long    llrintl(real x);
+        ///
+        pure real    roundl(real x);
+        ///
+        c_long  lroundl(real x);
+        ///
+        long    llroundl(real x);
+        ///
+        pure real    truncl(real x);
+        ///
+        real    fmodl(real x, real y);
+        ///
+        real    remainderl(real x, real y);
+        ///
+        real    remquol(real x, real y, int* quo);
+        ///
+        pure real    copysignl(real x, real y);
+        ///
+        pure real    nanl(char* tagp);
+        ///
+        real    nextafterl(real x, real y);
+        ///
+        double  nexttoward(double x, real y);
+        ///
+        float   nexttowardf(float x, real y);
+        ///
+        real    nexttowardl(real x, real y);
+        ///
+        real    fdiml(real x, real y);
+        ///
+        pure real    fmaxl(real x, real y);
+        ///
+        pure real    fminl(real x, real y);
+        ///
+        pure real    fmal(real x, real y, real z);
+    }
 }
index d3ee2cae8e53fedc5aa0a5acd4443994d049ec5f..c9b6d7b6b7ec058487b209f55b4f97575b95f8fc 100644 (file)
@@ -1303,54 +1303,118 @@ version (MinGW)
 }
 else version (CRuntime_Glibc)
 {
-    ///
-    pragma(printf)
-    int fprintf(FILE* stream, scope const char* format, scope const ...);
-    ///
-    pragma(scanf)
-    int __isoc99_fscanf(FILE* stream, scope const char* format, scope ...);
-    ///
-    alias fscanf = __isoc99_fscanf;
-    ///
-    pragma(printf)
-    int sprintf(scope char* s, scope const char* format, scope const ...);
-    ///
-    pragma(scanf)
-    int __isoc99_sscanf(scope const char* s, scope const char* format, scope ...);
-    ///
-    alias sscanf = __isoc99_sscanf;
-    ///
-    pragma(printf)
-    int vfprintf(FILE* stream, scope const char* format, va_list arg);
-    ///
-    pragma(scanf)
-    int __isoc99_vfscanf(FILE* stream, scope const char* format, va_list arg);
-    ///
-    alias vfscanf = __isoc99_vfscanf;
-    ///
-    pragma(printf)
-    int vsprintf(scope char* s, scope const char* format, va_list arg);
-    ///
-    pragma(scanf)
-    int __isoc99_vsscanf(scope const char* s, scope const char* format, va_list arg);
-    ///
-    alias vsscanf = __isoc99_vsscanf;
-    ///
-    pragma(printf)
-    int vprintf(scope const char* format, va_list arg);
-    ///
-    pragma(scanf)
-    int __isoc99_vscanf(scope const char* format, va_list arg);
-    ///
-    alias vscanf = __isoc99_vscanf;
-    ///
-    pragma(printf)
-    int printf(scope const char* format, scope const ...);
-    ///
-    pragma(scanf)
-    int __isoc99_scanf(scope const char* format, scope ...);
-    ///
-    alias scanf = __isoc99_scanf;
+    static if (PPCUseIEEE128)
+    {
+        ///
+        pragma(printf)
+        int __fprintfieee128(FILE* stream, scope const char* format, scope const ...);
+        ///
+        alias fprintf = __fprintfieee128;
+        ///
+        pragma(scanf)
+        int __isoc99_fscanfieee128(FILE* stream, scope const char* format, scope ...);
+        ///
+        alias fscanf = __isoc99_fscanfieee128;
+        ///
+        pragma(printf)
+        int __sprintfieee128(scope char* s, scope const char* format, scope const ...);
+        ///
+        alias sprintf = __sprintfieee128;
+        ///
+        pragma(scanf)
+        int __isoc99_sscanfieee128(scope const char* s, scope const char* format, scope ...);
+        ///
+        alias sscanf = __isoc99_sscanfieee128;
+        ///
+        pragma(printf)
+        int vfprintf(FILE* stream, scope const char* format, va_list arg);
+        ///
+        pragma(scanf)
+        int __isoc99_vfscanfieee128(FILE* stream, scope const char* format, va_list arg);
+        ///
+        alias vfscanf = __isoc99_vfscanfieee128;
+        ///
+        pragma(printf)
+        int __vsprintfieee128(scope char* s, scope const char* format, va_list arg);
+        ///
+        alias vsprintf = __vsprintfieee128;
+        ///
+        pragma(scanf)
+        int __isoc99_vsscanfieee128(scope const char* s, scope const char* format, va_list arg);
+        ///
+        alias vsscanf = __isoc99_vsscanfieee128;
+        ///
+        pragma(printf)
+        int __vprintfieee128(scope const char* format, va_list arg);
+        ///
+        alias vprintf = __vprintfieee128;
+        ///
+        pragma(scanf)
+        int __isoc99_vfscanfieee128(scope const char* format, va_list arg);
+        ///
+        alias vscanf = __isoc99_vfscanfieee128;
+        ///
+        pragma(printf)
+        int __printfieee128(scope const char* format, scope const ...);
+        ///
+        alias printf = __printfieee128;
+        ///
+        pragma(scanf)
+        int __isoc99_scanfieee128(scope const char* format, scope ...);
+        ///
+        alias scanf = __isoc99_scanfieee128;
+    }
+    else
+    {
+        ///
+        pragma(printf)
+        int fprintf(FILE* stream, scope const char* format, scope const ...);
+        ///
+        pragma(scanf)
+        int __isoc99_fscanf(FILE* stream, scope const char* format, scope ...);
+        ///
+        alias fscanf = __isoc99_fscanf;
+        ///
+        pragma(printf)
+        int sprintf(scope char* s, scope const char* format, scope const ...);
+        ///
+        pragma(scanf)
+        int __isoc99_sscanf(scope const char* s, scope const char* format, scope ...);
+        ///
+        alias sscanf = __isoc99_sscanf;
+        ///
+        pragma(printf)
+        int vfprintf(FILE* stream, scope const char* format, va_list arg);
+        ///
+        pragma(scanf)
+        int __isoc99_vfscanf(FILE* stream, scope const char* format, va_list arg);
+        ///
+        alias vfscanf = __isoc99_vfscanf;
+        ///
+        pragma(printf)
+        int vsprintf(scope char* s, scope const char* format, va_list arg);
+        ///
+        pragma(scanf)
+        int __isoc99_vsscanf(scope const char* s, scope const char* format, va_list arg);
+        ///
+        alias vsscanf = __isoc99_vsscanf;
+        ///
+        pragma(printf)
+        int vprintf(scope const char* format, va_list arg);
+        ///
+        pragma(scanf)
+        int __isoc99_vscanf(scope const char* format, va_list arg);
+        ///
+        alias vscanf = __isoc99_vscanf;
+        ///
+        pragma(printf)
+        int printf(scope const char* format, scope const ...);
+        ///
+        pragma(scanf)
+        int __isoc99_scanf(scope const char* format, scope ...);
+        ///
+        alias scanf = __isoc99_scanf;
+    }
 }
 else
 {
@@ -1544,12 +1608,28 @@ else version (CRuntime_Glibc)
     int  fileno(FILE *);
   }
 
-    ///
-    pragma(printf)
-    int  snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
-    ///
-    pragma(printf)
-    int  vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
+    static if (PPCUseIEEE128)
+    {
+        ///
+        pragma(printf)
+        int  __snprintfieee128(scope char* s, size_t n, scope const char* format, scope const ...);
+        ///
+        alias snprintf = __snprintfieee128;
+        ///
+        pragma(printf)
+        int  __vsnprintfieee128(scope char* s, size_t n, scope const char* format, va_list arg);
+        ///
+        alias vsnprintf = __vsnprintfieee128;
+    }
+    else
+    {
+        ///
+        pragma(printf)
+        int  snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
+        ///
+        pragma(printf)
+        int  vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
+    }
 
     //
     // Gnu under-the-hood C I/O functions. Uses _iobuf* for the unshared
index bd5fc2b15eaee3244d7c6278a88f5a9257df9ee3..52fa1d0f70cf35efd1b2da8a3f9d2afa11b4244d 100644 (file)
@@ -147,8 +147,16 @@ version (CRuntime_Microsoft)
 }
 else
 {
-    /// Added to Bionic since Lollipop.
-    real strtold(scope inout(char)* nptr, scope inout(char)** endptr);
+    static if (PPCUseIEEE128)
+    {
+        real __strtoieee128(scope inout(char)* nptr, scope inout(char)** endptr);
+        alias strtold = __strtoieee128;
+    }
+    else
+    {
+        /// Added to Bionic since Lollipop.
+        real strtold(scope inout(char)* nptr, scope inout(char)** endptr);
+    }
 }
 
 // No unsafe pointer manipulation.
index 9054ce589e86a5b8d8d7baed42746d1f260bde24..013d9f06e604fc86c445b916ff17baba120c577a 100644 (file)
@@ -11,13 +11,15 @@ $(RED Warning:
  */
 
 module core.sys.windows.sql;
+
+enum ODBCVER = 0x0400;
+
+deprecated ("The ODBC 3.5 modules are deprecated. Please use the ODBC4 modules in the `etc.c.odbc` package."):
 version (Windows):
 
 public import core.sys.windows.sqltypes;
 import core.sys.windows.windef;
 
-enum ODBCVER = 0x0351;
-
 enum SQL_ACCESSIBLE_PROCEDURES=20;
 enum SQL_ACCESSIBLE_TABLES=19;
 enum SQL_ALL_TYPES=0;
index b871fbbbb84161202cf999363012f389ea38045c..a53918394dc47901d6925ef98d1389b66cabe925 100644 (file)
@@ -11,6 +11,7 @@ $(RED Warning:
  */
 
 module core.sys.windows.sqlext;
+deprecated ("The ODBC 3.5 modules are deprecated. Please use the ODBC4 modules in the `etc.c.odbc` package."):
 version (Windows):
 
 /* Conversion notes:
index 04fac6bac6aee193dffdc430ffc37261d0d09ca8..ca91f0158511e095ed93266116aeb0c30714b3ee 100644 (file)
@@ -70,6 +70,10 @@ alias long   ODBCINT64, SQLBIGINT;
 alias ulong  SQLUBIGINT;
 //}
 
+//Everything above this line may by used by odbcinst.d
+//Everything below this line is deprecated
+deprecated ("The ODBC 3.5 modules are deprecated. Please use the ODBC4 modules in the `etc.c.odbc` package."):
+
 struct DATE_STRUCT {
     SQLSMALLINT year;
     SQLUSMALLINT month;
index e7ae1d276be8d964d04bbf1ba85be96a929cf6d2..d20952d5b4b4aed57d7adf798df56209d91e564d 100644 (file)
@@ -11,6 +11,7 @@ $(RED Warning:
  */
 
 module core.sys.windows.sqlucode;
+deprecated ("The ODBC 3.5 modules are deprecated. Please use the ODBC4 modules in the `etc.c.odbc` package."):
 version (Windows):
 
 version (ANSI) {} else version = Unicode;
index d8389ae491f9c707bc7646b57d9f3d1bc414a4cc..e274fd30e8c4c0244aec5c2787f4a800fb5862be 100644 (file)
@@ -1324,8 +1324,16 @@ class TypeInfo_AssociativeArray : TypeInfo
     override @property inout(TypeInfo) next() nothrow pure inout { return value; }
     override @property uint flags() nothrow pure const { return 1; }
 
+    // TypeInfo entry is generated from the type of this template to help rt/aaA.d
+    static struct Entry(K, V)
+    {
+        K key;
+        V value;
+    }
+
     TypeInfo value;
     TypeInfo key;
+    TypeInfo entry;
 
     override @property size_t talign() nothrow pure const
     {
index 2bddeaf41d7c094a006baa3e5b4a545fab76564e..3b4bee0405821de046adb7f250250df1ef46b410 100644 (file)
@@ -66,13 +66,13 @@ private:
         if ((ti.key.flags | ti.value.flags) & 1)
             flags |= Flags.hasPointers;
 
-        entryTI = fakeEntryTI(this, ti.key, ti.value);
+        entryTI = ti.entry;
     }
 
     Bucket[] buckets;
     uint used;
     uint deleted;
-    TypeInfo_Struct entryTI;
+    const(TypeInfo) entryTI;
     uint firstUsed;
     immutable uint keysz;
     immutable uint valsz;
@@ -229,15 +229,6 @@ private void* allocEntry(scope const Impl* aa, scope const void* pkey)
     return res;
 }
 
-package void entryDtor(void* p, const TypeInfo_Struct sti)
-{
-    // key and value type info stored after the TypeInfo_Struct by tiEntry()
-    auto sizeti = __traits(classInstanceSize, TypeInfo_Struct);
-    auto extra = cast(const(TypeInfo)*)(cast(void*) sti + sizeti);
-    extra[0].destroy(p);
-    extra[1].destroy(p + talign(extra[0].tsize, extra[1].talign));
-}
-
 private bool hasDtor(const TypeInfo ti) pure nothrow
 {
     import rt.lifetime : unqualify;
@@ -258,132 +249,6 @@ private immutable(void)* getRTInfo(const TypeInfo ti) pure nothrow
     return isNoClass ? ti.rtInfo() : rtinfoHasPointers;
 }
 
-// build type info for Entry with additional key and value fields
-TypeInfo_Struct fakeEntryTI(ref Impl aa, const TypeInfo keyti, const TypeInfo valti) nothrow
-{
-    import rt.lifetime : unqualify;
-
-    auto kti = unqualify(keyti);
-    auto vti = unqualify(valti);
-
-    // figure out whether RTInfo has to be generated (indicated by rtisize > 0)
-    enum pointersPerWord = 8 * (void*).sizeof * (void*).sizeof;
-    auto rtinfo = rtinfoNoPointers;
-    size_t rtisize = 0;
-    immutable(size_t)* keyinfo = void;
-    immutable(size_t)* valinfo = void;
-    if (aa.flags & Impl.Flags.hasPointers)
-    {
-        // classes are references
-        keyinfo = cast(immutable(size_t)*) getRTInfo(keyti);
-        valinfo = cast(immutable(size_t)*) getRTInfo(valti);
-
-        if (keyinfo is rtinfoHasPointers && valinfo is rtinfoHasPointers)
-            rtinfo = rtinfoHasPointers;
-        else
-            rtisize = 1 + (aa.valoff + aa.valsz + pointersPerWord - 1) / pointersPerWord;
-    }
-    bool entryHasDtor = hasDtor(kti) || hasDtor(vti);
-    if (rtisize == 0 && !entryHasDtor)
-        return null;
-
-    // save kti and vti after type info for struct
-    enum sizeti = __traits(classInstanceSize, TypeInfo_Struct);
-    void* p = GC.malloc(sizeti + (2 + rtisize) * (void*).sizeof);
-    import core.stdc.string : memcpy;
-
-    memcpy(p, __traits(initSymbol, TypeInfo_Struct).ptr, sizeti);
-
-    auto ti = cast(TypeInfo_Struct) p;
-    auto extra = cast(TypeInfo*)(p + sizeti);
-    extra[0] = cast() kti;
-    extra[1] = cast() vti;
-
-    static immutable tiMangledName = "S2rt3aaA__T5EntryZ";
-    ti.mangledName = tiMangledName;
-
-    ti.m_RTInfo = rtisize > 0 ? rtinfoEntry(aa, keyinfo, valinfo, cast(size_t*)(extra + 2), rtisize) : rtinfo;
-    ti.m_flags = ti.m_RTInfo is rtinfoNoPointers ? cast(TypeInfo_Struct.StructFlags)0 : TypeInfo_Struct.StructFlags.hasPointers;
-
-    // we don't expect the Entry objects to be used outside of this module, so we have control
-    // over the non-usage of the callback methods and other entries and can keep these null
-    // xtoHash, xopEquals, xopCmp, xtoString and xpostblit
-    immutable entrySize = aa.valoff + aa.valsz;
-    ti.m_init = (cast(ubyte*) null)[0 .. entrySize]; // init length, but not ptr
-
-    if (entryHasDtor)
-    {
-        // xdtor needs to be built from the dtors of key and value for the GC
-        ti.xdtorti = &entryDtor;
-        ti.m_flags |= TypeInfo_Struct.StructFlags.isDynamicType;
-    }
-
-    ti.m_align = cast(uint) max(kti.talign, vti.talign);
-
-    return ti;
-}
-
-// build appropriate RTInfo at runtime
-immutable(void)* rtinfoEntry(ref Impl aa, immutable(size_t)* keyinfo,
-    immutable(size_t)* valinfo, size_t* rtinfoData, size_t rtinfoSize) pure nothrow
-{
-    enum bitsPerWord = 8 * size_t.sizeof;
-
-    rtinfoData[0] = aa.valoff + aa.valsz;
-    rtinfoData[1..rtinfoSize] = 0;
-
-    void copyKeyInfo(string src)()
-    {
-        size_t pos = 1;
-        size_t keybits = aa.keysz / (void*).sizeof;
-        while (keybits >= bitsPerWord)
-        {
-            rtinfoData[pos] = mixin(src);
-            keybits -= bitsPerWord;
-            pos++;
-        }
-        if (keybits > 0)
-            rtinfoData[pos] = mixin(src) & ((size_t(1) << keybits) - 1);
-    }
-
-    if (keyinfo is rtinfoHasPointers)
-        copyKeyInfo!"~size_t(0)"();
-    else if (keyinfo !is rtinfoNoPointers)
-        copyKeyInfo!"keyinfo[pos]"();
-
-    void copyValInfo(string src)()
-    {
-        size_t bitpos = aa.valoff / (void*).sizeof;
-        size_t pos = 1;
-        size_t dstpos = 1 + bitpos / bitsPerWord;
-        size_t begoff = bitpos % bitsPerWord;
-        size_t valbits = aa.valsz / (void*).sizeof;
-        size_t endoff = (bitpos + valbits) % bitsPerWord;
-        for (;;)
-        {
-            const bits = bitsPerWord - begoff;
-            size_t s = mixin(src);
-            rtinfoData[dstpos] |= s << begoff;
-            if (begoff > 0 && valbits > bits)
-                rtinfoData[dstpos+1] |= s >> bits;
-            if (valbits < bitsPerWord)
-                break;
-            valbits -= bitsPerWord;
-            dstpos++;
-            pos++;
-        }
-        if (endoff > 0)
-            rtinfoData[dstpos] &= (size_t(1) << endoff) - 1;
-    }
-
-    if (valinfo is rtinfoHasPointers)
-        copyValInfo!"~size_t(0)"();
-    else if (valinfo !is rtinfoNoPointers)
-        copyValInfo!"valinfo[pos]"();
-
-    return cast(immutable(void)*) rtinfoData;
-}
-
 unittest
 {
     void test(K, V)()
@@ -402,12 +267,10 @@ unittest
         if (valrti is rtinfoNoPointers && keyrti is rtinfoNoPointers)
         {
             assert(!(impl.flags & Impl.Flags.hasPointers));
-            assert(impl.entryTI is null);
         }
         else if (valrti is rtinfoHasPointers && keyrti is rtinfoHasPointers)
         {
             assert(impl.flags & Impl.Flags.hasPointers);
-            assert(impl.entryTI is null);
         }
         else
         {
@@ -977,7 +840,10 @@ unittest
     aa1 = null;
     aa2 = null;
     aa3 = null;
-    GC.runFinalizers((cast(char*)&entryDtor)[0 .. 1]);
+    auto dtor1 = typeid(TypeInfo_AssociativeArray.Entry!(int, T)).xdtor;
+    GC.runFinalizers((cast(char*)dtor1)[0 .. 1]);
+    auto dtor2 = typeid(TypeInfo_AssociativeArray.Entry!(T, int)).xdtor;
+    GC.runFinalizers((cast(char*)dtor2)[0 .. 1]);
     assert(T.dtor == 6 && T.postblit == 2);
 }
 
index b63a5bf5266ed3f9b2ee543dd58c7e1a94c61d4b..f77d8b9c4e82dd6ec1900326dbd480baace30946 100644 (file)
@@ -1587,16 +1587,13 @@ deprecated unittest
     GC.free(blkinf.base);
 
     // associative arrays
-    import rt.aaA : entryDtor;
-    // throw away all existing AA entries with dtor
-    GC.runFinalizers((cast(char*)&entryDtor)[0..1]);
-
     S1[int] aa1;
     aa1[0] = S1(0);
     aa1[1] = S1(1);
     dtorCount = 0;
     aa1 = null;
-    GC.runFinalizers((cast(char*)&entryDtor)[0..1]);
+    auto dtor1 = typeid(TypeInfo_AssociativeArray.Entry!(int, S1)).xdtor;
+    GC.runFinalizers((cast(char*)dtor1)[0..1]);
     assert(dtorCount == 2);
 
     int[S1] aa2;
@@ -1605,7 +1602,8 @@ deprecated unittest
     aa2[S1(2)] = 2;
     dtorCount = 0;
     aa2 = null;
-    GC.runFinalizers((cast(char*)&entryDtor)[0..1]);
+    auto dtor2 = typeid(TypeInfo_AssociativeArray.Entry!(S1, int)).xdtor;
+    GC.runFinalizers((cast(char*)dtor2)[0..1]);
     assert(dtorCount == 3);
 
     S1[2][int] aa3;
@@ -1613,7 +1611,8 @@ deprecated unittest
     aa3[1] = [S1(1),S1(3)];
     dtorCount = 0;
     aa3 = null;
-    GC.runFinalizers((cast(char*)&entryDtor)[0..1]);
+    auto dtor3 = typeid(TypeInfo_AssociativeArray.Entry!(int, S1[2])).xdtor;
+    GC.runFinalizers((cast(char*)dtor3)[0..1]);
     assert(dtorCount == 4);
 }