diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2025-01-09 23:56:49 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2025-01-12 23:18:25 +0100 |
commit | a2e540bf0150b1a2f05924ce6d5210dc0048471d (patch) | |
tree | b46d2d634704cfea7200180a0d03ddc5303aab0b /gcc | |
parent | f4fa0b7d493a4ba217d989d3df75bbe3730874fc (diff) | |
download | gcc-a2e540bf0150b1a2f05924ce6d5210dc0048471d.zip gcc-a2e540bf0150b1a2f05924ce6d5210dc0048471d.tar.gz gcc-a2e540bf0150b1a2f05924ce6d5210dc0048471d.tar.bz2 |
d: Merge dmd, druntime c7902293d7, phobos 03aeafd20
D front-end changes:
- Import dmd v2.110.0-rc.1.
- An error is now given for subtracting pointers of different
types.
D runtime changes:
- Import druntime v2.110.0-rc.1.
Phobos changes:
- Import phobos v2.110.0-rc.1.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd c7902293d7.
* dmd/VERSION: Bump version to v2.110.0-rc.1.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime c7902293d7.
* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Rename
core/thread/fiber.d to core/thread/fiber/package.d. Add
core/thread/fiber/base.d.
* libdruntime/Makefile.in: Regenerate.
* src/MERGE: Merge upstream phobos 63fdb282f.
gcc/testsuite/ChangeLog:
* gdc.dg/asm3.d: Adjust test.
* gdc.dg/torture/pr96435.d: Adjust test.
Diffstat (limited to 'gcc')
171 files changed, 744 insertions, 650 deletions
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index e5884c6..b145d1b 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -c57da0cf5945cfb45eed06f1fd820435cda3ee3a +c7902293d7df9d02546562cb09fc8439004a70d1 The first line of this file holds the git revision number of the last merge done from the dlang/dmd repository. diff --git a/gcc/d/dmd/VERSION b/gcc/d/dmd/VERSION index eef25e2..5aab7a2 100644 --- a/gcc/d/dmd/VERSION +++ b/gcc/d/dmd/VERSION @@ -1 +1 @@ -v2.110.0-beta.1 +v2.110.0-rc.1 diff --git a/gcc/d/dmd/cond.d b/gcc/d/dmd/cond.d index cffc412..f66f14a 100644 --- a/gcc/d/dmd/cond.d +++ b/gcc/d/dmd/cond.d @@ -322,7 +322,7 @@ extern (C++) final class StaticForeach : RootObject { foreach (params; pparams) { - auto p = aggrfe ? (*aggrfe.parameters)[i] : rangefe.prm; + auto p = aggrfe ? (*aggrfe.parameters)[i] : rangefe.param; params.push(new Parameter(aloc, p.storageClass, p.type, p.ident, null, null)); } } diff --git a/gcc/d/dmd/ctfeexpr.d b/gcc/d/dmd/ctfeexpr.d index 8f17a6e..156c5f8 100644 --- a/gcc/d/dmd/ctfeexpr.d +++ b/gcc/d/dmd/ctfeexpr.d @@ -465,8 +465,7 @@ Expression resolveSlice(Expression e, UnionExp* pue = null) *pue = Slice(e.type, se.e1, se.lwr, se.upr); return pue.exp(); } - else - return Slice(e.type, se.e1, se.lwr, se.upr).copy(); + return Slice(e.type, se.e1, se.lwr, se.upr).copy(); } /* Determine the array length, without interpreting it. diff --git a/gcc/d/dmd/dcast.d b/gcc/d/dmd/dcast.d index c15322f..7c675eb 100644 --- a/gcc/d/dmd/dcast.d +++ b/gcc/d/dmd/dcast.d @@ -491,7 +491,7 @@ MATCH implicitConvTo(Expression e, Type t) case Tint16: if (ty == Tuns64 && value & ~0x7FFFU) return MATCH.nomatch; - else if (cast(short)value != value) + if (cast(short)value != value) return MATCH.nomatch; break; @@ -3261,7 +3261,7 @@ Expression scaleFactor(BinExp be, Scope* sc) if (eoff.op == EXP.int64 && eoff.toInteger() == 0) { } - else if (sc.setUnsafe(false, be.loc, "pointer arithmetic not allowed in @safe functions")) + else if (sc.setUnsafe(false, be.loc, "pointer arithmetic")) { return ErrorExp.get(); } diff --git a/gcc/d/dmd/declaration.h b/gcc/d/dmd/declaration.h index a98213d..7f37f89 100644 --- a/gcc/d/dmd/declaration.h +++ b/gcc/d/dmd/declaration.h @@ -632,6 +632,8 @@ public: bool nothrowInprocess(bool v); bool nogcInprocess() const; bool nogcInprocess(bool v); + bool saferD() const; + bool saferD(bool v); bool scopeInprocess() const; bool scopeInprocess(bool v); bool inlineScanned() const; diff --git a/gcc/d/dmd/dscope.d b/gcc/d/dmd/dscope.d index 76627be..8648231 100644 --- a/gcc/d/dmd/dscope.d +++ b/gcc/d/dmd/dscope.d @@ -72,8 +72,51 @@ private extern (D) struct BitFields bool canFree; /// is on free list bool fullinst; /// fully instantiate templates bool ctfeBlock; /// inside a `if (__ctfe)` block - bool dip1000; /// dip1000 errors enabled for this scope - bool dip25; /// dip25 errors enabled for this scope +} + +/// State of -preview switches +/// +/// By making them part of a Scope, we reduce reliance on dmd.globals, +/// and can enable/disable them per module / edition. +private struct Previews +{ + // Run `dmd -preview=h` for the meaning of these switches + private extern (D) static struct BitFields + { + bool bitfields; + bool dip1000; + bool dip1008; + bool dip1021; + bool dip25; + bool fixAliasThis; + bool fixImmutableConv; + bool in_; + bool inclusiveInContracts; + bool noSharedAccess; + bool rvalueRefParam; + bool safer; + FeatureState systemVariables; + } + + import dmd.common.bitfields : generateBitFields; + mixin(generateBitFields!(BitFields, ushort)); + + void setFromParams(ref Param params) @nogc nothrow pure @safe + { + this.bitfields = params.bitfields; + this.dip1000 = params.useDIP1000 == FeatureState.enabled; + this.dip1008 = params.ehnogc; + this.dip1021 = params.useDIP1021; // == FeatureState.enabled; + this.dip25 = params.useDIP25 == FeatureState.enabled; + this.fixAliasThis = params.fixAliasThis; + this.fixImmutableConv = params.fixImmutableConv; + this.in_ = params.previewIn; + this.inclusiveInContracts = params.inclusiveInContracts; + this.noSharedAccess = params.noSharedAccess == FeatureState.enabled; + this.rvalueRefParam = params.rvalueRefParam == FeatureState.enabled; + this.safer = params.safer == FeatureState.enabled; + this.systemVariables = params.systemVariables; + } } extern (C++) struct Scope @@ -136,7 +179,9 @@ extern (C++) struct Scope DeprecatedDeclaration depdecl; /// customized deprecation message import dmd.common.bitfields : generateBitFields; - mixin(generateBitFields!(BitFields, uint)); + mixin(generateBitFields!(BitFields, ushort)); + + Previews previews; // user defined attributes UserAttributeDeclaration userAttribDecl; @@ -181,10 +226,8 @@ extern (C++) struct Scope m = m.parent; m.addMember(null, sc.scopesym); m.parent = null; // got changed by addMember() - if (global.params.useDIP1000 == FeatureState.enabled) - sc.dip1000 = true; - if (global.params.useDIP25 == FeatureState.enabled) - sc.dip25 = true; + sc.previews.setFromParams(global.params); + if (_module.filetype == FileType.c) sc.inCfile = true; // Create the module scope underneath the global scope @@ -236,9 +279,7 @@ extern (C++) struct Scope s.ignoresymbolvisibility = this.ignoresymbolvisibility; s.inCfile = this.inCfile; s.ctfeBlock = this.ctfeBlock; - s.dip1000 = this.dip1000; - s.dip25 = this.dip25; - + s.previews = this.previews; s.lastdc = null; assert(&this != s); return s; @@ -519,7 +560,7 @@ extern (C++) struct Scope } NotFound: - if (global.params.fixAliasThis) + if (sc.previews.fixAliasThis) { Expression exp = new ThisExp(loc); if (Dsymbol aliasSym = checkAliasThis(sc.scopesym.isAggregateDeclaration(), ident, flags, &exp)) @@ -856,13 +897,13 @@ extern (C++) struct Scope /// Returns: whether to raise DIP1000 warnings (FeatureStabe.default) or errors (FeatureState.enabled) extern (D) FeatureState useDIP1000() { - return (this.dip1000 || hasEdition(Edition.v2024)) ? FeatureState.enabled : FeatureState.disabled; + return (this.previews.dip1000 || hasEdition(Edition.v2024)) ? FeatureState.enabled : FeatureState.disabled; } /// Returns: whether to raise DIP25 warnings (FeatureStabe.default) or errors (FeatureState.enabled) extern (D) FeatureState useDIP25() { - return (this.dip25 || hasEdition(Edition.v2024)) ? FeatureState.enabled : FeatureState.disabled; + return (this.previews.dip25 || hasEdition(Edition.v2024)) ? FeatureState.enabled : FeatureState.disabled; } /// Returns: whether this scope compiles with `edition` or later diff --git a/gcc/d/dmd/dsymbol.d b/gcc/d/dmd/dsymbol.d index 3aed16a..e3feefe 100644 --- a/gcc/d/dmd/dsymbol.d +++ b/gcc/d/dmd/dsymbol.d @@ -577,7 +577,7 @@ extern (C++) class Dsymbol : ASTNode continue; if (sa == p1) return true; - else if (p2 && sa == p2) + if (p2 && sa == p2) return true; } outer = ti.tempdecl.toParent(); diff --git a/gcc/d/dmd/dsymbolsem.d b/gcc/d/dmd/dsymbolsem.d index 7e98436..1ab646f4 100644 --- a/gcc/d/dmd/dsymbolsem.d +++ b/gcc/d/dmd/dsymbolsem.d @@ -717,7 +717,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor // Calculate type size + safety checks if (dsym.storage_class & STC.gshared && !dsym.isMember()) { - sc.setUnsafe(false, dsym.loc, "__gshared not allowed in safe functions; use shared"); + sc.setUnsafe(false, dsym.loc, "using `__gshared` instead of `shared`"); } Dsymbol parent = dsym.toParent(); @@ -1146,22 +1146,22 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor if (dsym.type.hasPointers()) // also computes type size sc.setUnsafe(false, dsym.loc, - "`void` initializers for pointers not allowed in safe functions"); + "`void` initializing a pointer"); else if (dsym.type.hasInvariant()) sc.setUnsafe(false, dsym.loc, - "`void` initializers for structs with invariants are not allowed in safe functions"); + "`void` initializing a struct with an invariant"); else if (dsym.type.toBasetype().ty == Tbool) sc.setUnsafePreview(global.params.systemVariables, false, dsym.loc, - "a `bool` must be 0 or 1, so void intializing it is not allowed in safe functions"); + "void intializing a bool (which must always be 0 or 1)"); else if (dsym.type.hasUnsafeBitpatterns()) sc.setUnsafePreview(global.params.systemVariables, false, dsym.loc, - "`void` initializers for types with unsafe bit patterns are not allowed in safe functions"); + "`void` initializing a type with unsafe bit patterns"); } else if (!dsym._init && !(dsym.storage_class & (STC.static_ | STC.extern_ | STC.gshared | STC.manifest | STC.field | STC.parameter)) && dsym.type.hasVoidInitPointers()) { - sc.setUnsafe(false, dsym.loc, "`void` initializers for pointers not allowed in safe functions"); + sc.setUnsafe(false, dsym.loc, "`void` initializers for pointers"); } } @@ -1323,7 +1323,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor { import dmd.escape : setUnsafeDIP1000; const inSafeFunc = sc.func && sc.func.isSafeBypassingInference(); // isSafeBypassingInference may call setUnsafe(). - if (setUnsafeDIP1000(*sc, false, dsym.loc, "`scope` allocation of `%s` requires that constructor be annotated with `scope`", dsym)) + if (setUnsafeDIP1000(*sc, false, dsym.loc, "`scope` allocation of `%s` with a non-`scope` constructor", dsym)) errorSupplemental(ne.member.loc, "is the location of the constructor"); } ne.onstack = 1; @@ -1577,7 +1577,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor if (dsym.errors) return; - if (!(global.params.bitfields || sc.inCfile)) + if (!(sc.previews.bitfields || sc.inCfile)) { version (IN_GCC) .error(dsym.loc, "%s `%s` use `-fpreview=bitfields` for bitfield support", dsym.kind, dsym.toPrettyChars); diff --git a/gcc/d/dmd/dtemplate.d b/gcc/d/dmd/dtemplate.d index d46e466..5bb7049 100644 --- a/gcc/d/dmd/dtemplate.d +++ b/gcc/d/dmd/dtemplate.d @@ -211,11 +211,11 @@ Dsymbol getDsymbol(RootObject oarg) // Try to convert Expression to symbol if (auto ve = ea.isVarExp()) return ve.var; - else if (auto fe = ea.isFuncExp()) + if (auto fe = ea.isFuncExp()) return fe.td ? fe.td : fe.fd; - else if (auto te = ea.isTemplateExp()) + if (auto te = ea.isTemplateExp()) return te.td; - else if (auto te = ea.isScopeExp()) + if (auto te = ea.isScopeExp()) return te.sds; else return null; diff --git a/gcc/d/dmd/escape.d b/gcc/d/dmd/escape.d index 3e18051..947abf0 100644 --- a/gcc/d/dmd/escape.d +++ b/gcc/d/dmd/escape.d @@ -354,7 +354,7 @@ bool checkParamArgumentEscape(ref Scope sc, FuncDeclaration fdc, Identifier parI if (assertmsg) { result |= sc.setUnsafeDIP1000(gag, arg.loc, - desc ~ " `%s` assigned to non-scope parameter calling `assert()`", v); + "assigning" ~ desc ~ " `%s` to non-scope parameter calling `assert()`", v); return; } @@ -362,9 +362,9 @@ bool checkParamArgumentEscape(ref Scope sc, FuncDeclaration fdc, Identifier parI const(char)* msg = (isThis) ? (desc ~ " `%s` calling non-scope member function `%s.%s()`") : - (fdc && parId) ? (desc ~ " `%s` assigned to non-scope parameter `%s` calling `%s`") : - (fdc && !parId) ? (desc ~ " `%s` assigned to non-scope anonymous parameter calling `%s`") : - (!fdc && parId) ? (desc ~ " `%s` assigned to non-scope parameter `%s`") : + (fdc && parId) ? ("assigning " ~ desc ~ " `%s` to non-scope parameter `%s` calling `%s`") : + (fdc && !parId) ? ("assigning " ~ desc ~ " `%s` to non-scope anonymous parameter calling `%s`") : + (!fdc && parId) ? ("assigning " ~ desc ~ " `%s` to non-scope parameter `%s`") : (desc ~ " `%s` assigned to non-scope anonymous parameter"); if (isThis ? @@ -440,8 +440,8 @@ bool checkParamArgumentEscape(ref Scope sc, FuncDeclaration fdc, Identifier parI if (parStc & STC.scope_) return; const(char)* msg = parId ? - "reference to stack allocated value returned by `%s` assigned to non-scope parameter `%s`" : - "reference to stack allocated value returned by `%s` assigned to non-scope anonymous parameter"; + "assigning reference to stack allocated value returned by `%s` to non-scope parameter `%s`" : + "assigning reference to stack allocated value returned by `%s` to non-scope anonymous parameter"; result |= sc.setUnsafeDIP1000(gag, ee.loc, msg, ee, parId); } @@ -726,16 +726,16 @@ bool checkAssignEscape(ref Scope sc, Expression e, bool gag, bool byRef) { case EnclosedBy.none: assert(0); case EnclosedBy.returnScope: - msg = "scope variable `%s` assigned to return scope `%s`"; + msg = "assigning scope variable `%s` to return scope `%s`"; break; case EnclosedBy.longerScope: - msg = "scope variable `%s` assigned to `%s` with longer lifetime"; + msg = "assigning scope variable `%s` to `%s` with longer lifetime"; break; case EnclosedBy.refVar: - msg = "scope variable `%s` assigned to `ref` variable `%s` with longer lifetime"; + msg = "assigning scope variable `%s` to `ref` variable `%s` with longer lifetime"; break; case EnclosedBy.global: - msg = "scope variable `%s` assigned to global variable `%s`"; + msg = "assigning scope variable `%s` to global variable `%s`"; break; } @@ -762,7 +762,7 @@ bool checkAssignEscape(ref Scope sc, Expression e, bool gag, bool byRef) } return; } - result |= sc.setUnsafeDIP1000(gag, ae.loc, "scope variable `%s` assigned to non-scope `%s`", v, e1); + result |= sc.setUnsafeDIP1000(gag, ae.loc, "assigning scope variable `%s` to non-scope `%s`", v, e1); } else { @@ -794,7 +794,7 @@ bool checkAssignEscape(ref Scope sc, Expression e, bool gag, bool byRef) else { result |= sc.setUnsafeDIP1000(gag, ae.loc, - "address of local variable `%s` assigned to return scope `%s`", v, va); + "assigning address of local variable `%s` to return scope `%s`", v, va); } } @@ -809,7 +809,7 @@ bool checkAssignEscape(ref Scope sc, Expression e, bool gag, bool byRef) // If va's lifetime encloses v's, then error if (va && !(vaIsFirstRef && v.isReturn()) && va.enclosesLifetimeOf(v)) { - if (sc.setUnsafeDIP1000(gag, ae.loc, "address of variable `%s` assigned to `%s` with longer lifetime", v, va)) + if (sc.setUnsafeDIP1000(gag, ae.loc, "assigning address of variable `%s` to `%s` with longer lifetime", v, va)) { result = true; return; @@ -829,7 +829,7 @@ bool checkAssignEscape(ref Scope sc, Expression e, bool gag, bool byRef) return; } - result |= sc.setUnsafeDIP1000(gag, ae.loc, "reference to local variable `%s` assigned to non-scope `%s`", v, e1); + result |= sc.setUnsafeDIP1000(gag, ae.loc, "assigning reference to local variable `%s` to non-scope `%s`", v, e1); } void onFunc(FuncDeclaration func, bool called) @@ -869,7 +869,7 @@ bool checkAssignEscape(ref Scope sc, Expression e, bool gag, bool byRef) return; } result |= sc.setUnsafeDIP1000(gag, ae.loc, - "reference to local `%s` assigned to non-scope `%s` in @safe code", v, e1); + "assigning reference to local `%s` to non-scope `%s`", v, e1); } } @@ -889,8 +889,8 @@ bool checkAssignEscape(ref Scope sc, Expression e, bool gag, bool byRef) } const(char)* msg = (ee.op == EXP.structLiteral) ? - "address of struct literal `%s` assigned to `%s` with longer lifetime" : - "address of expression temporary returned by `%s` assigned to `%s` with longer lifetime"; + "assigning address of struct literal `%s` to `%s` with longer lifetime" : + "assigning address of expression temporary returned by `%s` to `%s` with longer lifetime"; result |= sc.setUnsafeDIP1000(gag, ee.loc, msg, ee, e1); } @@ -930,7 +930,7 @@ bool checkThrowEscape(ref Scope sc, Expression e, bool gag) // despite being `scope` { // https://issues.dlang.org/show_bug.cgi?id=17029 - result |= sc.setUnsafeDIP1000(gag, e.loc, "scope variable `%s` may not be thrown", v); + result |= sc.setUnsafeDIP1000(gag, e.loc, "throwing scope variable `%s`", v); return; } else @@ -989,7 +989,7 @@ bool checkNewEscape(ref Scope sc, Expression e, bool gag) !(p.parent == sc.func)) { // https://issues.dlang.org/show_bug.cgi?id=20868 - result |= sc.setUnsafeDIP1000(gag, e.loc, "scope variable `%s` may not be copied into allocated memory", v); + result |= sc.setUnsafeDIP1000(gag, e.loc, "copying scope variable `%s` into allocated memory", v); return; } } @@ -1009,9 +1009,9 @@ bool checkNewEscape(ref Scope sc, Expression e, bool gag) bool escapingRef(VarDeclaration v, FeatureState fs) { const(char)* msg = v.isParameter() ? - "copying `%s` into allocated memory escapes a reference to parameter `%s`" : - "copying `%s` into allocated memory escapes a reference to local variable `%s`"; - return setUnsafePreview(&sc, fs, gag, e.loc, msg, e, v); + "escaping a reference to parameter `%s` by copying `%s` into allocated memory" : + "escaping a reference to local variable `%s` by copying `%s` into allocated memory"; + return setUnsafePreview(&sc, fs, gag, e.loc, msg, v, e); } Dsymbol p = v.toParent2(); @@ -1064,14 +1064,14 @@ bool checkNewEscape(ref Scope sc, Expression e, bool gag) { if (called) result |= sc.setUnsafeDIP1000(gag, e.loc, - "nested function `%s` returns `scope` values and escapes them into allocated memory", fd); + "escaping a `scope` value returned from nested function `%s` into allocated memory", fd); } void onExp(Expression ee, bool retRefTransition) { if (log) printf("byexp %s\n", ee.toChars()); if (!gag) - sc.eSink.error(ee.loc, "storing reference to stack allocated value returned by `%s` into allocated memory causes it to escape", + sc.eSink.error(ee.loc, "escaping reference to stack allocated value returned by `%s` into allocated memory", ee.toChars()); result = true; } @@ -1210,7 +1210,7 @@ private bool checkReturnEscapeImpl(ref Scope sc, Expression e, bool refs, bool g else { // https://issues.dlang.org/show_bug.cgi?id=17029 - result |= sc.setUnsafeDIP1000(gag, e.loc, "scope variable `%s` may not be returned", v); + result |= sc.setUnsafeDIP1000(gag, e.loc, "returning scope variable `%s`", v); return; } } @@ -1233,13 +1233,12 @@ private bool checkReturnEscapeImpl(ref Scope sc, Expression e, bool refs, bool g // depending on the flag passed to the CLI for DIP25 void escapingRef(VarDeclaration v, FeatureState featureState) { - const(char)* msg = v.isParameter() ? - "returning `%s` escapes a reference to parameter `%s`" : - "returning `%s` escapes a reference to local variable `%s`"; - + const(char)* safeMsg = v.isParameter() ? + "escaping a reference to parameter `%s` by returning `%s`" : + "escaping a reference to local variable `%s` by returning `%s` "; if (v.isParameter() && v.isReference()) { - if (setUnsafePreview(&sc, featureState, gag, e.loc, msg, e, v) || + if (setUnsafePreview(&sc, featureState, gag, e.loc, safeMsg, v, e) || sc.func.isSafeBypassingInference()) { result = true; @@ -1260,10 +1259,13 @@ private bool checkReturnEscapeImpl(ref Scope sc, Expression e, bool refs, bool g { if (retRefTransition) { - result |= sc.setUnsafeDIP1000(gag, e.loc, msg, e, v); + result |= sc.setUnsafeDIP1000(gag, e.loc, safeMsg, v, e); } else { + const(char)* msg = v.isParameter() ? + "returning `%s` escapes a reference to parameter `%s`" : + "returning `%s` escapes a reference to local variable `%s`"; if (!gag) previewErrorFunc(sc.isDeprecated(), featureState)(e.loc, msg, e.toChars(), v.toChars()); result = true; @@ -2228,7 +2230,7 @@ private bool checkScopeVarAddr(VarDeclaration v, Expression e, ref Scope sc, boo // take address of `scope` variable not allowed, requires transitive scope return sc.setUnsafeDIP1000(gag, e.loc, - "cannot take address of `scope` variable `%s` since `scope` applies to first indirection only", v); + "taking address of `scope` variable `%s` with pointers", v); } /**************************** diff --git a/gcc/d/dmd/expressionsem.d b/gcc/d/dmd/expressionsem.d index 413d31a..3020387 100644 --- a/gcc/d/dmd/expressionsem.d +++ b/gcc/d/dmd/expressionsem.d @@ -1607,8 +1607,8 @@ Lagain: { if (sd.isSystem()) { - if (sc.setUnsafePreview(global.params.systemVariables, false, loc, - "cannot access `@system` variable `%s` in @safe code", sd)) + if (sc.setUnsafePreview(sc.previews.systemVariables, false, loc, + "access `@system` variable `%s`", sd)) { if (auto v = sd.isVarDeclaration()) { @@ -2237,8 +2237,7 @@ private bool checkPurity(VarDeclaration v, const ref Loc loc, Scope* sc) */ if (v.storage_class & STC.gshared) { - if (sc.setUnsafe(false, loc, - "`@safe` function `%s` cannot access `__gshared` data `%s`", sc.func, v)) + if (sc.setUnsafe(false, loc, "accessing `__gshared` data `%s`", v)) { err = true; } @@ -3328,7 +3327,7 @@ private bool functionParameters(const ref Loc loc, Scope* sc, } else if (p.storageClass & STC.ref_) { - if (global.params.rvalueRefParam == FeatureState.enabled && + if (sc.previews.rvalueRefParam && !arg.isLvalue() && targ.isCopyable()) { /* allow rvalues to be passed to ref parameters by copying @@ -3729,7 +3728,7 @@ private bool functionParameters(const ref Loc loc, Scope* sc, /* Test compliance with DIP1021 Argument Ownership and Function Calls */ - if (global.params.useDIP1021 && (tf.trust == TRUST.safe || tf.trust == TRUST.default_) || + if (sc.previews.dip1021 && (tf.trust == TRUST.safe || tf.trust == TRUST.default_) || tf.isLive) err |= checkMutableArguments(*sc, fd, tf, ethis, arguments, false); @@ -4012,7 +4011,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor } } - if (global.params.fixAliasThis) + if (sc.previews.fixAliasThis) { if (ExpressionDsymbol expDsym = scopesym.isExpressionDsymbol()) { @@ -4028,7 +4027,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor return; } - if (!global.params.fixAliasThis && hasThis(sc)) + if (!sc.previews.fixAliasThis && hasThis(sc)) { for (AggregateDeclaration ad = sc.getStructClassScope(); ad;) { @@ -5175,7 +5174,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor // When using `@nogc` exception handling, lower `throw new E(args)` to // `throw (__tmp = _d_newThrowable!E(), __tmp.__ctor(args), __tmp)`. - if (global.params.ehnogc && exp.thrownew && + if (sc.previews.dip1008 && exp.thrownew && !cd.isCOMclass() && !cd.isCPPclass()) { assert(cd.ctor); @@ -8596,8 +8595,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor */ if (1) { - if (sc.setUnsafe(false, exp.loc, - "cannot take address of lazy parameter `%s` in `@safe` function `%s`", ve, sc.func)) + if (sc.setUnsafe(false, exp.loc, "taking address of lazy parameter `%s`", ve)) { setError(); return; @@ -8746,9 +8744,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor } if (sc.func && !sc.intypeof && !sc.debug_) { - sc.setUnsafe(false, exp.loc, - "`this` reference necessary to take address of member `%s` in `@safe` function `%s`", - f, sc.func); + sc.setUnsafe(false, exp.loc, "taking address of member `%s` without `this` reference", f); } } } @@ -9240,7 +9236,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor if (!isSafeCast(ex, t1b, tob, msg)) { if (sc.setUnsafe(false, exp.loc, - "cast from `%s` to `%s` not allowed in safe code", exp.e1.type, exp.to)) + "cast from `%s` to `%s`", exp.e1.type, exp.to)) { if (msg.length) errorSupplemental(exp.loc, "%.*s", msg.fTuple.expand); @@ -9250,7 +9246,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor else if (msg.length) // deprecated unsafe { const err = sc.setUnsafePreview(FeatureState.default_, false, exp.loc, - "cast from `%s` to `%s` not allowed in safe code", exp.e1.type, exp.to); + "cast from `%s` to `%s`", exp.e1.type, exp.to); // if message was printed if (sc.func && sc.func.isSafeBypassingInference() && !sc.isDeprecated()) deprecationSupplemental(exp.loc, "%.*s", msg.fTuple.expand); @@ -9503,7 +9499,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor return setError(); } - if (sc.setUnsafe(false, exp.loc, "pointer slicing not allowed in safe functions")) + if (sc.setUnsafe(false, exp.loc, "pointer slicing")) return setError(); } else if (t1b.ty == Tarray) @@ -9991,7 +9987,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor if (exp.e2.op == EXP.int64 && exp.e2.toInteger() == 0) { } - else if (sc.setUnsafe(false, exp.loc, "`@safe` function `%s` cannot index pointer `%s`", sc.func, exp.e1)) + else if (sc.setUnsafe(false, exp.loc, "indexing pointer `%s`", exp.e1)) { return setError(); } @@ -11449,17 +11445,17 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor { if (t2.nextOf().implicitConvTo(t1.nextOf())) { - if (sc.setUnsafe(false, exp.loc, "cannot copy `%s` to `%s` in `@safe` code", t2, t1)) + if (sc.setUnsafe(false, exp.loc, "copying `%s` to `%s`", t2, t1)) return setError(); } else { // copying from non-void to void was overlooked, deprecate if (sc.setUnsafePreview(FeatureState.default_, false, exp.loc, - "cannot copy `%s` to `%s` in `@safe` code", t2, t1)) + "copying `%s` to `%s`", t2, t1)) return setError(); } - if (global.params.fixImmutableConv && !t2.implicitConvTo(t1)) + if (sc.previews.fixImmutableConv && !t2.implicitConvTo(t1)) { error(exp.loc, "cannot copy `%s` to `%s`", t2.toChars(), t1.toChars()); @@ -11848,7 +11844,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor (exp.e2.implicitConvTo(exp.e1.type) || (tb2.nextOf().implicitConvTo(tb1next) && // Do not strip const(void)[] - (!global.params.fixImmutableConv || tb1next.ty != Tvoid) && + (!sc.previews.fixImmutableConv || tb1next.ty != Tvoid) && (tb2.nextOf().size(Loc.initial) == tb1next.size(Loc.initial))))) { // EXP.concatenateAssign @@ -12245,12 +12241,10 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor if (!p1.equivalent(p2)) { - // Deprecation to remain for at least a year, after which this should be - // changed to an error // See https://github.com/dlang/dmd/pull/7332 - deprecation(exp.loc, - "cannot subtract pointers to different types: `%s` and `%s`.", + error(exp.loc, "cannot subtract pointers to different types: `%s` and `%s`.", t1.toChars(), t2.toChars()); + return setError(); } // Need to divide the result by the stride @@ -12590,7 +12584,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor if (exp.type.ty == Tarray && tb1next && tb2next && tb1next.mod != tb2next.mod) { // Do not strip const(void)[] - if (!global.params.fixImmutableConv || tb.nextOf().ty != Tvoid) + if (!sc.previews.fixImmutableConv || tb.nextOf().ty != Tvoid) exp.type = exp.type.nextOf().toHeadMutable().arrayOf(); } if (Type tbn = tb.nextOf()) @@ -14890,8 +14884,8 @@ private bool checkSharedAccessBin(BinExp binExp, Scope* sc) */ bool checkSharedAccess(Expression e, Scope* sc, bool returnRef = false) { - if (global.params.noSharedAccess != FeatureState.enabled || - !sc || + if (!sc || + !sc.previews.noSharedAccess || sc.intypeof || sc.ctfe) { @@ -15588,7 +15582,7 @@ private Expression toLvalueImpl(Expression _this, Scope* sc, const(char)* action with (_this) if (!trusted && !e1.type.pointerTo().implicitConvTo(to.pointerTo())) sc.setUnsafePreview(FeatureState.default_, false, loc, - "cast from `%s` to `%s` cannot be used as an lvalue in @safe code", + "using the result of a cast from `%s` to `%s` as an lvalue", e1.type, to); return _this; @@ -15956,7 +15950,7 @@ private Expression modifiableLvalueImpl(Expression _this, Scope* sc, Expression Expression visitDelegatePtr(DelegatePtrExp exp) { - if (sc.setUnsafe(false, exp.loc, "cannot modify delegate pointer in `@safe` code `%s`", exp)) + if (sc.setUnsafe(false, exp.loc, "modifying delegate pointer `%s`", exp)) { return ErrorExp.get(); } @@ -15965,7 +15959,7 @@ private Expression modifiableLvalueImpl(Expression _this, Scope* sc, Expression Expression visitDelegateFuncptr(DelegateFuncptrExp exp) { - if (sc.setUnsafe(false, exp.loc, "cannot modify delegate function pointer in `@safe` code `%s`", exp)) + if (sc.setUnsafe(false, exp.loc, "modifying delegate function pointer `%s`", exp)) { return ErrorExp.get(); } @@ -16034,7 +16028,7 @@ private bool checkAddressVar(Scope* sc, Expression exp, VarDeclaration v) { if (sc.useDIP1000 != FeatureState.enabled && !(v.storage_class & STC.temp) && - sc.setUnsafe(false, exp.loc, "cannot take address of local `%s` in `@safe` function `%s`", v, sc.func)) + sc.setUnsafe(false, exp.loc, "taking the address of stack-allocated local variable `%s`", v)) { return false; } @@ -16307,7 +16301,7 @@ private bool fit(StructDeclaration sd, const ref Loc loc, Scope* sc, Expressions if ((!stype.alignment.isDefault() && stype.alignment.get() < target.ptrsize || (v.offset & (target.ptrsize - 1))) && (sc.setUnsafe(false, loc, - "field `%s.%s` cannot assign to misaligned pointers in `@safe` code", sd, v))) + "field `%s.%s` assigning to misaligned pointers", sd, v))) { return false; } diff --git a/gcc/d/dmd/func.d b/gcc/d/dmd/func.d index 9c5a3d0..40d39ae 100644 --- a/gcc/d/dmd/func.d +++ b/gcc/d/dmd/func.d @@ -113,6 +113,7 @@ private struct FUNCFLAG bool safetyInprocess; /// working on determining safety bool nothrowInprocess; /// working on determining nothrow bool nogcInprocess; /// working on determining @nogc + bool saferD; /// do -preview=safer checks if this function has default safety bool scopeInprocess; /// infer `return` and `scope` for parameters bool inlineScanned; /// function has been scanned for inline possibilities bool hasCatches; /// function has try-catch statements diff --git a/gcc/d/dmd/funcsem.d b/gcc/d/dmd/funcsem.d index eba9397..39da025 100644 --- a/gcc/d/dmd/funcsem.d +++ b/gcc/d/dmd/funcsem.d @@ -1616,9 +1616,26 @@ FuncDeclaration resolveFuncCall(const ref Loc loc, Scope* sc, Dsymbol s, const(char)* lastprms = parametersTypeToChars(tf1.parameterList); const(char)* nextprms = parametersTypeToChars(tf2.parameterList); - .error(loc, "`%s.%s` called with argument types `%s` matches both:\n%s: `%s%s%s`\nand:\n%s: `%s%s%s`", + string match = ""; + final switch (m.last) + { + case MATCH.convert: + match = "after implicit conversions"; + break; + case MATCH.constant: + match = "after qualifier conversion"; + break; + case MATCH.exact: + match = "exactly"; + break; + case MATCH.nomatch: + assert(0); + } + + .error(loc, "`%s.%s` called with argument types `%s` matches multiple overloads %.*s:\n%s: `%s%s%s`\nand:\n%s: `%s%s%s`", s.parent.toPrettyChars(), s.ident.toChars(), fargsBuf.peekChars(), + match.fTuple.expand, m.lastf.loc.toChars(), m.lastf.toPrettyChars(), lastprms, tf1.modToChars(), m.nextf.loc.toChars(), m.nextf.toPrettyChars(), nextprms, tf2.modToChars()); return null; diff --git a/gcc/d/dmd/globals.d b/gcc/d/dmd/globals.d index 901561f..77bb498 100644 --- a/gcc/d/dmd/globals.d +++ b/gcc/d/dmd/globals.d @@ -400,6 +400,7 @@ extern (C++) struct Global params.v.color = detectTerminal(); } + params.v.errorPrintMode = ErrorPrintMode.printErrorContext; // Enable error context globally by default compileEnv.versionNumber = parseVersionNumber(versionString()); /* Initialize date, time, and timestamp diff --git a/gcc/d/dmd/hdrgen.d b/gcc/d/dmd/hdrgen.d index cfe4262..a5e897d 100644 --- a/gcc/d/dmd/hdrgen.d +++ b/gcc/d/dmd/hdrgen.d @@ -418,10 +418,10 @@ private void statementToBuffer(Statement s, ref OutBuffer buf, ref HdrGenState h { buf.writestring(Token.toString(s.op)); buf.writestring(" ("); - if (s.prm.type) - typeToBuffer(s.prm.type, s.prm.ident, buf, hgs); + if (s.param.type) + typeToBuffer(s.param.type, s.param.ident, buf, hgs); else - buf.writestring(s.prm.ident.toString()); + buf.writestring(s.param.ident.toString()); buf.writestring("; "); s.lwr.expressionToBuffer(buf, hgs); buf.writestring(" .. "); @@ -465,7 +465,7 @@ private void statementToBuffer(Statement s, ref OutBuffer buf, ref HdrGenState h void visitIf(IfStatement s) { buf.writestring("if ("); - printConditionAssignment(s.prm, s.condition); + printConditionAssignment(s.param, s.condition); buf.writeByte(')'); buf.writenl(); if (s.ifbody.isScopeStatement()) @@ -1168,14 +1168,14 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs) void foreachRangeWithoutBody(ForeachRangeStatement s) { - /* s.op ( prm ; lwr .. upr ) + /* s.op ( param ; lwr .. upr ) */ buf.writestring(Token.toString(s.op)); buf.writestring(" ("); - if (s.prm.type) - typeToBuffer(s.prm.type, s.prm.ident, buf, hgs); + if (s.param.type) + typeToBuffer(s.param.type, s.param.ident, buf, hgs); else - buf.writestring(s.prm.ident.toString()); + buf.writestring(s.param.ident.toString()); buf.writestring("; "); s.lwr.expressionToBuffer(buf, hgs); buf.writestring(" .. "); diff --git a/gcc/d/dmd/initsem.d b/gcc/d/dmd/initsem.d index 0c13bc7..aec6807 100644 --- a/gcc/d/dmd/initsem.d +++ b/gcc/d/dmd/initsem.d @@ -1592,7 +1592,7 @@ Expressions* resolveStructLiteralNamedArgs(StructDeclaration sd, Type t, Scope* (vd.offset & (target.ptrsize - 1)))) { if (sc.setUnsafe(false, argLoc, - "field `%s.%s` cannot assign to misaligned pointers in `@safe` code", sd, vd)) + "field `%s.%s` assigning to misaligned pointers", sd, vd)) { errors = true; elems[fieldi] = ErrorExp.get(); // for better diagnostics on multiple errors diff --git a/gcc/d/dmd/intrange.d b/gcc/d/dmd/intrange.d index d89fbb2..242cac0 100644 --- a/gcc/d/dmd/intrange.d +++ b/gcc/d/dmd/intrange.d @@ -69,7 +69,7 @@ struct SignExtendedNumber } if (value < a.value) return -1; - else if (value > a.value) + if (value > a.value) return 1; else return 0; @@ -121,10 +121,10 @@ struct SignExtendedNumber SignExtendedNumber opBinary(string op : "+")(SignExtendedNumber rhs) { uinteger_t sum = value + rhs.value; - bool carry = sum < value && sum < rhs.value; + const carry = sum < value && sum < rhs.value; if (negative != rhs.negative) return SignExtendedNumber(sum, !carry); - else if (negative) + if (negative) return SignExtendedNumber(carry ? sum : 0, true); else return SignExtendedNumber(carry ? ulong.max : sum, false); @@ -154,7 +154,7 @@ struct SignExtendedNumber { if (!negative) return this; - else if (rhs.negative) + if (rhs.negative) return max(); else return rhs.value == 0 ? rhs : this; @@ -248,7 +248,7 @@ struct SignExtendedNumber // shifts will give huge result. if (value == 0) return this; - else if (rhs.negative) + if (rhs.negative) return extreme(negative); uinteger_t v = copySign(value, negative); @@ -277,7 +277,7 @@ struct SignExtendedNumber { if (rhs.negative || rhs.value > 63) return negative ? SignExtendedNumber(-1, true) : SignExtendedNumber(0); - else if (isMinimum()) + if (isMinimum()) return rhs.value == 0 ? this : SignExtendedNumber(-1UL << (64 - rhs.value), true); uinteger_t x = value ^ -cast(int)negative; @@ -445,11 +445,10 @@ struct IntRange { if (!type.isIntegral() || type.toBasetype().isTypeVector()) return this; - else if (!type.isUnsigned()) + if (!type.isUnsigned()) return castSigned(type.sizemask()); - else if (type.toBasetype().ty == Tdchar) + if (type.toBasetype().ty == Tdchar) return castDchar(); - else return castUnsigned(type.sizemask()); } @@ -457,10 +456,9 @@ struct IntRange { if (!type.isIntegral() || type.toBasetype().isTypeVector()) return castUnsigned(ulong.max); - else if (type.toBasetype().ty == Tdchar) + if (type.toBasetype().ty == Tdchar) return castDchar(); - else - return castUnsigned(type.sizemask()); + return castUnsigned(type.sizemask()); } bool contains(IntRange a) @safe @@ -478,14 +476,11 @@ struct IntRange { if (imax.negative) return this; - else if (!imin.negative) + if (!imin.negative) return IntRange(-imax, -imin); - else - { - SignExtendedNumber imaxAbsNeg = -imax; - return IntRange(imaxAbsNeg < imin ? imaxAbsNeg : imin, - SignExtendedNumber(0)); - } + SignExtendedNumber imaxAbsNeg = -imax; + return IntRange(imaxAbsNeg < imin ? imaxAbsNeg : imin, + SignExtendedNumber(0)); } IntRange unionWith(const ref IntRange other) const @safe @@ -573,13 +568,13 @@ struct IntRange swap(l, r); // r spans [-1,0] } - auto minAndNeg = minAnd(l, IntRange(r.imin, SignExtendedNumber(-1))); - auto minAndPos = minAnd(l, IntRange(SignExtendedNumber(0), r.imax)); - auto maxAndNeg = maxAnd(l, IntRange(r.imin, SignExtendedNumber(-1))); - auto maxAndPos = maxAnd(l, IntRange(SignExtendedNumber(0), r.imax)); + const minAndNeg = minAnd(l, IntRange(r.imin, SignExtendedNumber(-1))); + const minAndPos = minAnd(l, IntRange(SignExtendedNumber(0), r.imax)); + const maxAndNeg = maxAnd(l, IntRange(r.imin, SignExtendedNumber(-1))); + const maxAndPos = maxAnd(l, IntRange(SignExtendedNumber(0), r.imax)); - auto min = minAndNeg < minAndPos ? minAndNeg : minAndPos; - auto max = maxAndNeg > maxAndPos ? maxAndNeg : maxAndPos; + const min = minAndNeg < minAndPos ? minAndNeg : minAndPos; + const max = maxAndNeg > maxAndPos ? maxAndNeg : maxAndPos; auto range = IntRange(min, max); return range; @@ -681,22 +676,19 @@ struct IntRange { return IntRange(imin / rhs.imax, imax / rhs.imin); } - else if (rhs.imin.negative && !rhs.imax.negative) // divisor spans [-1, 0, 1] + if (rhs.imin.negative && !rhs.imax.negative) // divisor spans [-1, 0, 1] { SignExtendedNumber[4] bdy = [-imin, imin, -imax, imax]; return IntRange.fromNumbers4(bdy.ptr); } - else - { - // [a,b] / [c,d] = [min (a/c, a/d, b/c, b/d), max (a/c, a/d, b/c, b/d)] - SignExtendedNumber[4] bdy; - bdy[0] = imin / rhs.imin; - bdy[1] = imin / rhs.imax; - bdy[2] = imax / rhs.imin; - bdy[3] = imax / rhs.imax; + // [a,b] / [c,d] = [min (a/c, a/d, b/c, b/d), max (a/c, a/d, b/c, b/d)] + SignExtendedNumber[4] bdy; + bdy[0] = imin / rhs.imin; + bdy[1] = imin / rhs.imax; + bdy[2] = imax / rhs.imin; + bdy[3] = imax / rhs.imax; - return IntRange.fromNumbers4(bdy.ptr); - } + return IntRange.fromNumbers4(bdy.ptr); } IntRange opBinary(string op : "%")(IntRange rhs) diff --git a/gcc/d/dmd/json.d b/gcc/d/dmd/json.d index 174a2d9..b1b5a4f 100644 --- a/gcc/d/dmd/json.d +++ b/gcc/d/dmd/json.d @@ -992,35 +992,34 @@ void json_generate(ref Modules modules, ref OutBuffer buf) // of modules representing their syntax. json.generateModules(modules); json.removeComma(); + return; } - else - { - // Generate the new format which is an object where each - // output option is its own field. - json.objectStart(); - if (global.params.jsonFieldFlags & JsonFieldFlags.compilerInfo) - { - json.propertyStart("compilerInfo"); - json.generateCompilerInfo(); - } - if (global.params.jsonFieldFlags & JsonFieldFlags.buildInfo) - { - json.propertyStart("buildInfo"); - json.generateBuildInfo(); - } - if (global.params.jsonFieldFlags & JsonFieldFlags.modules) - { - json.propertyStart("modules"); - json.generateModules(modules); - } - if (global.params.jsonFieldFlags & JsonFieldFlags.semantics) - { - json.propertyStart("semantics"); - json.generateSemantics(); - } - json.objectEnd(); + // Generate the new format which is an object where each + // output option is its own field. + + json.objectStart(); + if (global.params.jsonFieldFlags & JsonFieldFlags.compilerInfo) + { + json.propertyStart("compilerInfo"); + json.generateCompilerInfo(); + } + if (global.params.jsonFieldFlags & JsonFieldFlags.buildInfo) + { + json.propertyStart("buildInfo"); + json.generateBuildInfo(); + } + if (global.params.jsonFieldFlags & JsonFieldFlags.modules) + { + json.propertyStart("modules"); + json.generateModules(modules); + } + if (global.params.jsonFieldFlags & JsonFieldFlags.semantics) + { + json.propertyStart("semantics"); + json.generateSemantics(); } + json.objectEnd(); } /** diff --git a/gcc/d/dmd/mangle/cpp.d b/gcc/d/dmd/mangle/cpp.d index 9ce3f9c..67c9b53 100644 --- a/gcc/d/dmd/mangle/cpp.d +++ b/gcc/d/dmd/mangle/cpp.d @@ -15,10 +15,6 @@ * Follows Itanium C++ ABI 1.86 section 5.1 * http://refspecs.linux-foundation.org/cxxabi-1.86.html#mangling * which is where the grammar comments come from. - * - * Bugs: - * https://issues.dlang.org/query.cgi - * enter `C++, mangling` as the keywords. */ module dmd.mangle.cpp; diff --git a/gcc/d/dmd/nogc.d b/gcc/d/dmd/nogc.d index 4a060c9..ff1e173 100644 --- a/gcc/d/dmd/nogc.d +++ b/gcc/d/dmd/nogc.d @@ -46,6 +46,7 @@ public: FuncDeclaration f; bool checkOnly; // don't print errors bool err; + bool nogcExceptions; // -preview=dip1008 enabled extern (D) this(FuncDeclaration f) scope @safe { @@ -143,7 +144,7 @@ public: } if (e.onstack) return; - if (global.params.ehnogc && e.thrownew) + if (nogcExceptions && e.thrownew) return; // separate allocator is called for this, not the GC if (setGC(e, "cannot use `new` in `@nogc` %s `%s`")) @@ -224,6 +225,7 @@ Expression checkGC(Scope* sc, Expression e) { scope NOGCVisitor gcv = new NOGCVisitor(f); gcv.checkOnly = betterC; + gcv.nogcExceptions = sc.previews.dip1008; walkPostorder(e, gcv); if (gcv.err) { diff --git a/gcc/d/dmd/ob.d b/gcc/d/dmd/ob.d index ee4b652..2019e82 100644 --- a/gcc/d/dmd/ob.d +++ b/gcc/d/dmd/ob.d @@ -7,8 +7,6 @@ * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/ob.d, _ob.d) * Documentation: https://dlang.org/phobos/dmd_escape.html * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/ob.d - * Bug reports: use 'live' keyword: - * https://issues.dlang.org/buglist.cgi?bug_status=NEW&bug_status=REOPENED&keywords=live * References: https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1021.md Argument Ownership and Function Calls */ diff --git a/gcc/d/dmd/parse.d b/gcc/d/dmd/parse.d index fd42838..b408f8b 100644 --- a/gcc/d/dmd/parse.d +++ b/gcc/d/dmd/parse.d @@ -5683,7 +5683,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer } /*** - * Parse an assignment condition for if or while statements. + * Parse an assignment condition for `if`, `switch` or `while` statements. * * Returns: * The variable that is declared inside the condition diff --git a/gcc/d/dmd/root/string.d b/gcc/d/dmd/root/string.d index 383c59d..847af0e 100644 --- a/gcc/d/dmd/root/string.d +++ b/gcc/d/dmd/root/string.d @@ -365,13 +365,23 @@ auto splitLines(const char[] text) public this(const char[] text) { this.text = text; + this.index = 0; + this.eolIndex = 0; + this.nextIndex = 0; } - public bool empty() { return index == text.length; } + public bool empty() { advance(); return index >= text.length; } public void popFront() { advance(); index = nextIndex; } - public const(char)[] front() { advance(); return text[index .. eolIndex]; } + public const(char)[] front() + { + advance(); + if (index > eolIndex || index >= text.length) { + return ""; + } + return text[index .. eolIndex]; + } private void advance() { @@ -418,7 +428,7 @@ auto splitLines(const char[] text) if (i + 2 < text.length && text[i + 1] == 0x80 && (text[i + 2] == 0xA8 || text[i + 2] == 0xA9) - ) + ) { eolIndex = i; nextIndex = i + 3; @@ -430,6 +440,10 @@ auto splitLines(const char[] text) break; } } + + // No newline found; set indices to the end of the text + eolIndex = text.length; + nextIndex = text.length; } } diff --git a/gcc/d/dmd/safe.d b/gcc/d/dmd/safe.d index 86dff7b..f6427a3 100644 --- a/gcc/d/dmd/safe.d +++ b/gcc/d/dmd/safe.d @@ -17,6 +17,7 @@ import core.stdc.stdio; import dmd.aggregate; import dmd.astenums; +import dmd.common.outbuffer; import dmd.dcast : implicitConvTo; import dmd.dclass; import dmd.declaration; @@ -67,11 +68,10 @@ bool checkUnsafeAccess(Scope* sc, Expression e, bool readonly, bool printmsg) if (!ad) return false; - import dmd.globals : global; if (v.isSystem()) { - if (sc.setUnsafePreview(global.params.systemVariables, !printmsg, e.loc, - "cannot access `@system` field `%s.%s` in `@safe` code", ad, v)) + if (sc.setUnsafePreview(sc.previews.systemVariables, !printmsg, e.loc, + "accessing `@system` field `%s.%s`", ad, v)) return true; } @@ -91,7 +91,7 @@ bool checkUnsafeAccess(Scope* sc, Expression e, bool readonly, bool printmsg) if (v.overlapped) { if (sc.func.isSafeBypassingInference() && sc.setUnsafe(!printmsg, e.loc, - "field `%s.%s` cannot access pointers in `@safe` code that overlap other fields", ad, v)) + "accessing overlapped field `%s.%s` with pointers", ad, v)) { return true; } @@ -104,7 +104,7 @@ bool checkUnsafeAccess(Scope* sc, Expression e, bool readonly, bool printmsg) // To turn into an error, remove `isSafeBypassingInference` check in the // above if statement and remove the else branch sc.setUnsafePreview(FeatureState.default_, !printmsg, e.loc, - "field `%s.%s` cannot access pointers in `@safe` code that overlap other fields", ad, v); + "accessing overlapped field `%s.%s` with pointers", ad, v); } } } @@ -114,7 +114,7 @@ bool checkUnsafeAccess(Scope* sc, Expression e, bool readonly, bool printmsg) if (v.overlapped) { if (sc.setUnsafe(!printmsg, e.loc, - "field `%s.%s` cannot access structs with invariants in `@safe` code that overlap other fields", + "accessing overlapped field `%s.%s` with a structs invariant", ad, v)) return true; } @@ -125,7 +125,7 @@ bool checkUnsafeAccess(Scope* sc, Expression e, bool readonly, bool printmsg) // Should probably be turned into an error in a new edition if (v.type.hasUnsafeBitpatterns() && v.overlapped && sc.setUnsafePreview( FeatureState.default_, !printmsg, e.loc, - "cannot access overlapped field `%s.%s` with unsafe bit patterns in `@safe` code", ad, v) + "accessing overlapped field `%s.%s` with unsafe bit patterns", ad, v) ) { return true; @@ -140,7 +140,7 @@ bool checkUnsafeAccess(Scope* sc, Expression e, bool readonly, bool printmsg) (v.offset & (target.ptrsize - 1))) { if (sc.setUnsafe(!printmsg, e.loc, - "field `%s.%s` cannot modify misaligned pointers in `@safe` code", ad, v)) + "modifying misaligned pointers through field `%s.%s`", ad, v)) return true; } } @@ -148,7 +148,7 @@ bool checkUnsafeAccess(Scope* sc, Expression e, bool readonly, bool printmsg) if (v.overlapUnsafe) { if (sc.setUnsafe(!printmsg, e.loc, - "field `%s.%s` cannot modify fields in `@safe` code that overlap fields with other storage classes", + "modifying field `%s.%s` which overlaps with fields with other storage classes", ad, v)) { return true; @@ -181,6 +181,10 @@ bool isSafeCast(Expression e, Type tfrom, Type tto, ref string msg) auto tfromb = tfrom.toBasetype(); auto ttob = tto.toBasetype(); + // Casting to void* is always safe, https://github.com/dlang/dmd/issues/20514 + if (ttob.isTypePointer() && ttob.nextOf().toBasetype().ty == Tvoid) + return true; + if (ttob.ty == Tclass && tfromb.ty == Tclass) { ClassDeclaration cdfrom = tfromb.isClassHandle(); @@ -310,9 +314,9 @@ bool checkUnsafeDotExp(Scope* sc, Expression e, Identifier id, int flag) if (!(flag & DotExpFlag.noDeref)) // this use is attempting a dereference { if (id == Id.ptr) - return sc.setUnsafe(false, e.loc, "`%s.ptr` cannot be used in `@safe` code, use `&%s[0]` instead", e, e); + return sc.setUnsafe(false, e.loc, "using `%s.ptr` (instead of `&%s[0])`", e, e); else - return sc.setUnsafe(false, e.loc, "`%s.%s` cannot be used in `@safe` code", e, id); + return sc.setUnsafe(false, e.loc, "using `%s.%s`", e, id); } return false; } @@ -323,8 +327,7 @@ bool checkUnsafeDotExp(Scope* sc, Expression e, Identifier id, int flag) */ bool isSaferD(FuncDeclaration fd) { - return fd.type.toTypeFunction().trust == TRUST.default_ && - global.params.safer == FeatureState.enabled; + return fd.type.toTypeFunction().trust == TRUST.default_ && fd.saferD; } bool isSafe(FuncDeclaration fd) @@ -378,7 +381,15 @@ extern (D) void reportSafeError(FuncDeclaration fd, bool gag, Loc loc, else if (fd.isSafe() || fd.isSaferD()) { if (!gag && format) - .error(loc, format, arg0 ? arg0.toChars() : "", arg1 ? arg1.toChars() : "", arg2 ? arg2.toChars() : ""); + { + OutBuffer buf; + buf.printf(format, arg0 ? arg0.toChars() : "", arg1 ? arg1.toChars() : "", arg2 ? arg2.toChars() : ""); + if (fd.isSafe()) + buf.writestring(" is not allowed in a `@safe` function"); + else + buf.writestring(" is not allowed in a function with default safety with `-preview=safer`"); + .error(loc, buf.extractChars()); + } } } @@ -457,7 +468,11 @@ bool setUnsafe(Scope* sc, { if (sc.varDecl.storage_class & STC.safe) { - .error(loc, format, arg0 ? arg0.toChars() : "", arg1 ? arg1.toChars() : "", arg2 ? arg2.toChars() : ""); + OutBuffer buf; + buf.printf(format, arg0 ? arg0.toChars() : "", arg1 ? arg1.toChars() : "", arg2 ? arg2.toChars() : ""); + buf.printf(" can't initialize `@safe` variable `%s`", sc.varDecl.toChars()); + .error(loc, buf.extractChars()); + return true; } else if (!(sc.varDecl.storage_class & STC.trusted)) @@ -476,7 +491,10 @@ bool setUnsafe(Scope* sc, { // Message wil be gagged, but still call error() to update global.errors and for // -verrors=spec - .error(loc, format, arg0 ? arg0.toChars() : "", arg1 ? arg1.toChars() : "", arg2 ? arg2.toChars() : ""); + OutBuffer buf; + buf.printf(format, arg0 ? arg0.toChars() : "", arg1 ? arg1.toChars() : "", arg2 ? arg2.toChars() : ""); + buf.writestring(" is not allowed in a `@safe` function"); + .error(loc, buf.extractChars()); return true; } return false; @@ -534,7 +552,10 @@ bool setUnsafePreview(Scope* sc, FeatureState fs, bool gag, Loc loc, const(char) { if (!gag && !sc.isDeprecated()) { - deprecation(loc, format, arg0 ? arg0.toChars() : "", arg1 ? arg1.toChars() : "", arg2 ? arg2.toChars() : ""); + OutBuffer buf; + buf.printf(format, arg0 ? arg0.toChars() : "", arg1 ? arg1.toChars() : "", arg2 ? arg2.toChars() : ""); + buf.writestring(" will become `@system` in a future release"); + deprecation(loc, buf.extractChars()); } } else if (!sc.func.safetyViolation) diff --git a/gcc/d/dmd/scope.h b/gcc/d/dmd/scope.h index ac11266..0bde3d7 100644 --- a/gcc/d/dmd/scope.h +++ b/gcc/d/dmd/scope.h @@ -102,7 +102,8 @@ struct Scope final DeprecatedDeclaration *depdecl; // customized deprecation message - unsigned flags; + uint16_t flags; + uint16_t previews; // state of preview switches bool ctor() const; bool ctor(bool v); @@ -130,10 +131,6 @@ struct Scope final bool fullinst(bool v); bool ctfeBlock() const; bool ctfeBlock(bool v); - bool dip1000() const; - bool dip1000(bool v); - bool dip25() const; - bool dip25(bool v); UserAttributeDeclaration *userAttribDecl; // user defined attributes diff --git a/gcc/d/dmd/semantic3.d b/gcc/d/dmd/semantic3.d index 1ea1ca1..92e00e8 100644 --- a/gcc/d/dmd/semantic3.d +++ b/gcc/d/dmd/semantic3.d @@ -298,6 +298,7 @@ private extern(C++) final class Semantic3Visitor : Visitor return; funcdecl.semanticRun = PASS.semantic3; funcdecl.hasSemantic3Errors = false; + funcdecl.saferD = sc.previews.safer; if (!funcdecl.type || funcdecl.type.ty != Tfunction) return; @@ -975,7 +976,7 @@ private extern(C++) final class Semantic3Visitor : Visitor sc2 = sc2.pop(); } - if (global.params.inclusiveInContracts) + if (sc.previews.inclusiveInContracts) { funcdecl.frequire = funcdecl.mergeFrequireInclusivePreview( funcdecl.frequire, funcdecl.fdrequireParams); @@ -1393,7 +1394,7 @@ private extern(C++) final class Semantic3Visitor : Visitor } // Do live analysis - if (global.params.useDIP1021 && funcdecl.fbody && funcdecl.type.ty != Terror && + if (sc.previews.dip1021 && funcdecl.fbody && funcdecl.type.ty != Terror && funcdecl.type.isTypeFunction().isLive) { oblive(funcdecl); diff --git a/gcc/d/dmd/statement.d b/gcc/d/dmd/statement.d index 5c759b0..25c9eef 100644 --- a/gcc/d/dmd/statement.d +++ b/gcc/d/dmd/statement.d @@ -890,7 +890,7 @@ extern (C++) final class ForeachStatement : Statement extern (C++) final class ForeachRangeStatement : Statement { TOK op; // TOK.foreach_ or TOK.foreach_reverse_ - Parameter prm; // loop index variable + Parameter param; // loop index variable Expression lwr; Expression upr; Statement _body; @@ -898,11 +898,11 @@ extern (C++) final class ForeachRangeStatement : Statement VarDeclaration key; - extern (D) this(const ref Loc loc, TOK op, Parameter prm, Expression lwr, Expression upr, Statement _body, Loc endloc) @safe + extern (D) this(const ref Loc loc, TOK op, Parameter param, Expression lwr, Expression upr, Statement _body, Loc endloc) @safe { super(loc, STMT.ForeachRange); this.op = op; - this.prm = prm; + this.param = param; this.lwr = lwr; this.upr = upr; this._body = _body; @@ -911,7 +911,7 @@ extern (C++) final class ForeachRangeStatement : Statement override ForeachRangeStatement syntaxCopy() { - return new ForeachRangeStatement(loc, op, prm.syntaxCopy(), lwr.syntaxCopy(), upr.syntaxCopy(), _body ? _body.syntaxCopy() : null, endloc); + return new ForeachRangeStatement(loc, op, param.syntaxCopy(), lwr.syntaxCopy(), upr.syntaxCopy(), _body ? _body.syntaxCopy() : null, endloc); } override bool hasBreak() const pure nothrow @@ -935,17 +935,17 @@ extern (C++) final class ForeachRangeStatement : Statement */ extern (C++) final class IfStatement : Statement { - Parameter prm; + Parameter param; Expression condition; Statement ifbody; Statement elsebody; VarDeclaration match; // for MatchExpression results Loc endloc; // location of closing curly bracket - extern (D) this(const ref Loc loc, Parameter prm, Expression condition, Statement ifbody, Statement elsebody, Loc endloc) @safe + extern (D) this(const ref Loc loc, Parameter param, Expression condition, Statement ifbody, Statement elsebody, Loc endloc) @safe { super(loc, STMT.If); - this.prm = prm; + this.param = param; this.condition = condition; this.ifbody = ifbody; this.elsebody = elsebody; @@ -955,7 +955,7 @@ extern (C++) final class IfStatement : Statement override IfStatement syntaxCopy() { return new IfStatement(loc, - prm ? prm.syntaxCopy() : null, + param ? param.syntaxCopy() : null, condition.syntaxCopy(), ifbody ? ifbody.syntaxCopy() : null, elsebody ? elsebody.syntaxCopy() : null, diff --git a/gcc/d/dmd/statement.h b/gcc/d/dmd/statement.h index 9437238..e420cf4 100644 --- a/gcc/d/dmd/statement.h +++ b/gcc/d/dmd/statement.h @@ -346,7 +346,7 @@ class ForeachRangeStatement final : public Statement { public: TOK op; // TOKforeach or TOKforeach_reverse - Parameter *prm; // loop index variable + Parameter *param; // loop index variable Expression *lwr; Expression *upr; Statement *_body; @@ -364,7 +364,7 @@ public: class IfStatement final : public Statement { public: - Parameter *prm; + Parameter *param; Expression *condition; Statement *ifbody; Statement *elsebody; diff --git a/gcc/d/dmd/statementsem.d b/gcc/d/dmd/statementsem.d index d259abf..932830d 100644 --- a/gcc/d/dmd/statementsem.d +++ b/gcc/d/dmd/statementsem.d @@ -1471,25 +1471,25 @@ Statement statementSemanticVisit(Statement s, Scope* sc) return setError(); } - if (fs.prm.type) + if (fs.param.type) { - fs.prm.type = fs.prm.type.typeSemantic(loc, sc); - fs.prm.type = fs.prm.type.addStorageClass(fs.prm.storageClass); - fs.lwr = fs.lwr.implicitCastTo(sc, fs.prm.type); + fs.param.type = fs.param.type.typeSemantic(loc, sc); + fs.param.type = fs.param.type.addStorageClass(fs.param.storageClass); + fs.lwr = fs.lwr.implicitCastTo(sc, fs.param.type); - if (fs.upr.implicitConvTo(fs.prm.type) || (fs.prm.storageClass & STC.ref_)) + if (fs.upr.implicitConvTo(fs.param.type) || (fs.param.storageClass & STC.ref_)) { - fs.upr = fs.upr.implicitCastTo(sc, fs.prm.type); + fs.upr = fs.upr.implicitCastTo(sc, fs.param.type); } else { - // See if upr-1 fits in prm.type + // See if upr-1 fits in param.type Expression limit = new MinExp(loc, fs.upr, IntegerExp.literal!1); limit = limit.expressionSemantic(sc); limit = limit.optimize(WANTvalue); - if (!limit.implicitConvTo(fs.prm.type)) + if (!limit.implicitConvTo(fs.param.type)) { - fs.upr = fs.upr.implicitCastTo(sc, fs.prm.type); + fs.upr = fs.upr.implicitCastTo(sc, fs.param.type); } } } @@ -1502,26 +1502,26 @@ Statement statementSemanticVisit(Statement s, Scope* sc) { /* Just picking the first really isn't good enough. */ - fs.prm.type = fs.lwr.type; + fs.param.type = fs.lwr.type; } else if (fs.lwr.type == fs.upr.type) { /* Same logic as CondExp ?lwr:upr */ - fs.prm.type = fs.lwr.type; + fs.param.type = fs.lwr.type; } else { scope AddExp ea = new AddExp(loc, fs.lwr, fs.upr); if (typeCombine(ea, sc)) return setError(); - fs.prm.type = ea.type; + fs.param.type = ea.type; fs.lwr = ea.e1; fs.upr = ea.e2; } - fs.prm.type = fs.prm.type.addStorageClass(fs.prm.storageClass); + fs.param.type = fs.param.type.addStorageClass(fs.param.storageClass); } - if (fs.prm.type.ty == Terror || fs.lwr.op == EXP.error || fs.upr.op == EXP.error) + if (fs.param.type.ty == Terror || fs.lwr.op == EXP.error || fs.upr.op == EXP.error) { return setError(); } @@ -1566,7 +1566,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc) if (fs.op == TOK.foreach_reverse_) { cond = new PostExp(EXP.minusMinus, loc, new VarExp(loc, fs.key)); - if (fs.prm.type.isScalar()) + if (fs.param.type.isScalar()) { // key-- > tmp cond = new CmpExp(EXP.greaterThan, loc, cond, new VarExp(loc, tmp)); @@ -1579,7 +1579,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc) } else { - if (fs.prm.type.isScalar()) + if (fs.param.type.isScalar()) { // key < tmp cond = new CmpExp(EXP.lessThan, loc, new VarExp(loc, fs.key), new VarExp(loc, tmp)); @@ -1598,30 +1598,30 @@ Statement statementSemanticVisit(Statement s, Scope* sc) //increment = new AddAssignExp(loc, new VarExp(loc, fs.key), IntegerExp.literal!1); increment = new PreExp(EXP.prePlusPlus, loc, new VarExp(loc, fs.key)); } - if ((fs.prm.storageClass & STC.ref_) && fs.prm.type.equals(fs.key.type)) + if ((fs.param.storageClass & STC.ref_) && fs.param.type.equals(fs.key.type)) { fs.key.range = null; - auto v = new AliasDeclaration(loc, fs.prm.ident, fs.key); + auto v = new AliasDeclaration(loc, fs.param.ident, fs.key); fs._body = new CompoundStatement(loc, new ExpStatement(loc, v), fs._body); } else { - ie = new ExpInitializer(loc, new CastExp(loc, new VarExp(loc, fs.key), fs.prm.type)); - auto v = new VarDeclaration(loc, fs.prm.type, fs.prm.ident, ie); - v.storage_class |= STC.temp | STC.foreach_ | (fs.prm.storageClass & STC.ref_); + ie = new ExpInitializer(loc, new CastExp(loc, new VarExp(loc, fs.key), fs.param.type)); + auto v = new VarDeclaration(loc, fs.param.type, fs.param.ident, ie); + v.storage_class |= STC.temp | STC.foreach_ | (fs.param.storageClass & STC.ref_); fs._body = new CompoundStatement(loc, new ExpStatement(loc, v), fs._body); - if (fs.key.range && !fs.prm.type.isMutable()) + if (fs.key.range && !fs.param.type.isMutable()) { /* Limit the range of the key to the specified range */ v.range = new IntRange(fs.key.range.imin, fs.key.range.imax - SignExtendedNumber(1)); } } - if (fs.prm.storageClass & STC.ref_) + if (fs.param.storageClass & STC.ref_) { - if (fs.key.type.constConv(fs.prm.type) == MATCH.nomatch) + if (fs.key.type.constConv(fs.param.type) == MATCH.nomatch) { - error(fs.loc, "argument type mismatch, `%s` to `ref %s`", fs.key.type.toChars(), fs.prm.type.toChars()); + error(fs.loc, "argument type mismatch, `%s` to `ref %s`", fs.key.type.toChars(), fs.param.type.toChars()); return setError(); } } @@ -1644,15 +1644,15 @@ Statement statementSemanticVisit(Statement s, Scope* sc) sym.parent = sc.scopesym; sym.endlinnum = ifs.endloc.linnum; Scope* scd = sc.push(sym); - if (ifs.prm) + if (ifs.param) { - /* Declare prm, which we will set to be the + /* Declare param, which we will set to be the * result of condition. */ auto ei = new ExpInitializer(ifs.loc, ifs.condition); - ifs.match = new VarDeclaration(ifs.loc, ifs.prm.type, ifs.prm.ident, ei); + ifs.match = new VarDeclaration(ifs.loc, ifs.param.type, ifs.param.ident, ei); ifs.match.parent = scd.func; - ifs.match.storage_class |= ifs.prm.storageClass; + ifs.match.storage_class |= ifs.param.storageClass; ifs.match.dsymbolSemantic(scd); auto de = new DeclarationExp(ifs.loc, ifs.match); @@ -1688,8 +1688,8 @@ Statement statementSemanticVisit(Statement s, Scope* sc) if (checkNonAssignmentArrayOp(ifs.condition)) ifs.condition = ErrorExp.get(); - // Convert to boolean after declaring prm so this works: - // if (S prm = S()) {} + // Convert to boolean after declaring param so this works: + // if (S param = S()) {} // where S is a struct that defines opCast!bool. ifs.condition = ifs.condition.toBoolean(scd); @@ -2677,7 +2677,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc) // If we previously assumed the function could be ref when // checking for `shared`, make sure we were right - if (global.params.noSharedAccess == FeatureState.enabled && rs.exp.type.isShared()) + if (sc.previews.noSharedAccess && rs.exp.type.isShared()) { .error(fd.loc, "%s `%s` function returns `shared` but cannot be inferred `ref`", fd.kind, fd.toPrettyChars); supplemental(); @@ -3634,7 +3634,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc) deprecation(cas.loc, "`asm` statement cannot be marked `@safe`, use `@system` or `@trusted` instead"); if (!(cas.stc & (STC.trusted | STC.safe))) { - sc.setUnsafe(false, cas.loc, "`asm` statement is assumed to be `@system` - mark it with `@trusted` if it is not"); + sc.setUnsafe(false, cas.loc, "`asm` statement without `@trusted` annotation"); } sc.pop(); @@ -3997,12 +3997,12 @@ private FuncExp foreachBodyToFunction(Scope* sc, ForeachStatement fs, TypeFuncti p.type = p.type.addStorageClass(p.storageClass); if (tfld) { - Parameter prm = tfld.parameterList[i]; - //printf("\tprm = %s%s\n", (prm.storageClass&STC.ref_?"ref ":"").ptr, prm.ident.toChars()); - stc = (prm.storageClass & STC.ref_) | (p.storageClass & STC.scope_); - if ((p.storageClass & STC.ref_) != (prm.storageClass & STC.ref_)) + Parameter param = tfld.parameterList[i]; + //printf("\tparam = %s%s\n", (param.storageClass&STC.ref_?"ref ":"").ptr, param.ident.toChars()); + stc = (param.storageClass & STC.ref_) | (p.storageClass & STC.scope_); + if ((p.storageClass & STC.ref_) != (param.storageClass & STC.ref_)) { - if (!(prm.storageClass & STC.ref_)) + if (!(param.storageClass & STC.ref_)) { error(fs.loc, "`foreach`: cannot make `%s` `ref`", p.ident.toChars()); return null; @@ -4115,7 +4115,7 @@ void catchSemantic(Catch c, Scope* sc) } if (!c.internalCatch) { - if (sc.setUnsafe(false, c.loc, "cannot catch C++ class objects in `@safe` code")) + if (sc.setUnsafe(false, c.loc, "catching C++ class objects")) c.errors = true; } } @@ -4127,18 +4127,18 @@ void catchSemantic(Catch c, Scope* sc) else if (!c.internalCatch && ClassDeclaration.exception && cd != ClassDeclaration.exception && !ClassDeclaration.exception.isBaseOf(cd, null) && sc.setUnsafe(false, c.loc, - "can only catch class objects derived from `Exception` in `@safe` code, not `%s`", c.type)) + "catching class objects derived from `%s` instead of `Exception`", c.type)) { c.errors = true; } - else if (global.params.ehnogc) + else if (sc.previews.dip1008) { stc |= STC.scope_; } // DIP1008 requires destruction of the Throwable, even if the user didn't specify an identifier auto ident = c.ident; - if (!ident && global.params.ehnogc) + if (!ident && sc.previews.dip1008) ident = Identifier.generateAnonymousId("var"); if (ident) @@ -4148,7 +4148,7 @@ void catchSemantic(Catch c, Scope* sc) c.var.dsymbolSemantic(sc); sc.insert(c.var); - if (global.params.ehnogc && stc & STC.scope_) + if (sc.previews.dip1008 && stc & STC.scope_) { /* Add a destructor for c.var * try { handler } finally { if (!__ctfe) _d_delThrowable(var); } diff --git a/gcc/d/dmd/templatesem.d b/gcc/d/dmd/templatesem.d index 8be9730..a69edef 100644 --- a/gcc/d/dmd/templatesem.d +++ b/gcc/d/dmd/templatesem.d @@ -1362,7 +1362,7 @@ extern (D) MATCHpair deduceFunctionTemplateMatch(TemplateDeclaration td, Templat { // Allow conversion from T[lwr .. upr] to ref T[upr-lwr] } - else if (global.params.rvalueRefParam == FeatureState.enabled) + else if (sc.previews.rvalueRefParam) { // Allow implicit conversion to ref } diff --git a/gcc/d/dmd/typesem.d b/gcc/d/dmd/typesem.d index 2ec88f2..c631e64 100644 --- a/gcc/d/dmd/typesem.d +++ b/gcc/d/dmd/typesem.d @@ -1122,7 +1122,7 @@ private extern(D) MATCH argumentMatchParameter (FuncDeclaration fd, TypeFunction // Need to make this a rvalue through a temporary m = MATCH.convert; } - else if (global.params.rvalueRefParam != FeatureState.enabled || + else if (!(sc && sc.previews.rvalueRefParam) || p.storageClass & STC.out_ || !arg.type.isCopyable()) // can't copy to temp for ref parameter { @@ -2335,8 +2335,7 @@ Type typeSemantic(Type type, const ref Loc loc, Scope* sc) // default arg must be an lvalue if (isRefOrOut && !isAuto && - !(fparam.storageClass & STC.constscoperef) && - global.params.rvalueRefParam != FeatureState.enabled) + !(fparam.storageClass & STC.constscoperef) && !sc.previews.rvalueRefParam) e = e.toLvalue(sc, "create default argument for `ref` / `out` parameter from"); fparam.defaultArg = e; diff --git a/gcc/d/dmd/visitor/transitive.d b/gcc/d/dmd/visitor/transitive.d index 952460c..c3ce13e 100644 --- a/gcc/d/dmd/visitor/transitive.d +++ b/gcc/d/dmd/visitor/transitive.d @@ -153,8 +153,8 @@ package(dmd.visitor) mixin template ParseVisitMethods(AST) override void visit(AST.ForeachRangeStatement s) { //printf("Visiting ForeachRangeStatement\n"); - if (s.prm.type) - visitType(s.prm.type); + if (s.param.type) + visitType(s.param.type); s.lwr.accept(this); s.upr.accept(this); if (s._body) @@ -174,8 +174,8 @@ package(dmd.visitor) mixin template ParseVisitMethods(AST) override void visit(AST.IfStatement s) { //printf("Visiting IfStatement\n"); - if (s.prm && s.prm.type) - visitType(s.prm.type); + if (s.param && s.param.type) + visitType(s.param.type); s.condition.accept(this); s.ifbody.accept(this); if (s.elsebody) diff --git a/gcc/testsuite/gdc.dg/asm3.d b/gcc/testsuite/gdc.dg/asm3.d index d792b24..eadb1c7 100644 --- a/gcc/testsuite/gdc.dg/asm3.d +++ b/gcc/testsuite/gdc.dg/asm3.d @@ -19,6 +19,6 @@ void test3() @nogc void test4() @safe { - asm { } // { dg-error "'asm' statement is assumed to be '@system' - mark it with '@trusted' if it is not" } + asm { } // { dg-error "'asm' statement without '@trusted' annotation is not allowed in a '@safe' function" } } diff --git a/gcc/testsuite/gdc.dg/torture/pr96435.d b/gcc/testsuite/gdc.dg/torture/pr96435.d index 0fbfd47..f694d11 100644 --- a/gcc/testsuite/gdc.dg/torture/pr96435.d +++ b/gcc/testsuite/gdc.dg/torture/pr96435.d @@ -7,8 +7,8 @@ union U { int i; bool b; } U u; u.i = 0x81818181; - assert(array[u.b] == 678); // { dg-warning "cannot access overlapped field" } - return u.b; // { dg-warning "cannot access overlapped field" } + assert(array[u.b] == 678); // { dg-warning "accessing overlapped field" } + return u.b; // { dg-warning "accessing overlapped field" } } @safe void main() diff --git a/gcc/testsuite/gdc.test/compilable/b16976.d b/gcc/testsuite/gdc.test/compilable/b16976.d index f5f45ef..fd9c539 100644 --- a/gcc/testsuite/gdc.test/compilable/b16976.d +++ b/gcc/testsuite/gdc.test/compilable/b16976.d @@ -1,4 +1,4 @@ -/* REQUIRED_ARGS: -m64 +/* REQUIRED_ARGS: -verrors=simple -m64 TEST_OUTPUT: --- compilable/b16976.d(33): Deprecation: foreach: loop index implicitly converted from `size_t` to `int` diff --git a/gcc/testsuite/gdc.test/compilable/chkformat.d b/gcc/testsuite/gdc.test/compilable/chkformat.d index ccbe974..5c352c1 100644 --- a/gcc/testsuite/gdc.test/compilable/chkformat.d +++ b/gcc/testsuite/gdc.test/compilable/chkformat.d @@ -1,9 +1,10 @@ // https://issues.dlang.org/show_bug.cgi?id=20643 // https://issues.dlang.org/show_bug.cgi?id=20644 +// REQUIRED_ARGS: -verrors=simple /* TEST_OUTPUT: ---- -compilable/chkformat.d(14): Deprecation: more format specifiers than 0 arguments +compilable/chkformat.d(15): Deprecation: more format specifiers than 0 arguments ---- */ import core.stdc.stdio; diff --git a/gcc/testsuite/gdc.test/compilable/compile1.d b/gcc/testsuite/gdc.test/compilable/compile1.d index 15973cf..f0b6dff 100644 --- a/gcc/testsuite/gdc.test/compilable/compile1.d +++ b/gcc/testsuite/gdc.test/compilable/compile1.d @@ -1,9 +1,10 @@ // COMPILABLE_MATH_TEST // PERMUTE_ARGS: +// REQUIRED_ARGS: -verrors=simple // EXTRA_FILES: imports/a12506.d /* TEST_OUTPUT: --- -compilable/compile1.d(230): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead +compilable/compile1.d(231): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead --- */ diff --git a/gcc/testsuite/gdc.test/compilable/ddoc10236.d b/gcc/testsuite/gdc.test/compilable/ddoc10236.d index c272894..41d63cd 100644 --- a/gcc/testsuite/gdc.test/compilable/ddoc10236.d +++ b/gcc/testsuite/gdc.test/compilable/ddoc10236.d @@ -1,5 +1,5 @@ // PERMUTE_ARGS: -// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -wi -o- +// REQUIRED_ARGS: -verrors=simple -D -Dd${RESULTS_DIR}/compilable -wi -o- /* TEST_OUTPUT: diff --git a/gcc/testsuite/gdc.test/compilable/ddoc10236b.d b/gcc/testsuite/gdc.test/compilable/ddoc10236b.d index 85783e8..ce3264e 100644 --- a/gcc/testsuite/gdc.test/compilable/ddoc10236b.d +++ b/gcc/testsuite/gdc.test/compilable/ddoc10236b.d @@ -1,5 +1,5 @@ // PERMUTE_ARGS: -// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -wi -o- +// REQUIRED_ARGS: -verrors=simple -D -Dd${RESULTS_DIR}/compilable -wi -o- /* TEST_OUTPUT: diff --git a/gcc/testsuite/gdc.test/compilable/ddoc13502.d b/gcc/testsuite/gdc.test/compilable/ddoc13502.d index 93f383f..3bfb617 100644 --- a/gcc/testsuite/gdc.test/compilable/ddoc13502.d +++ b/gcc/testsuite/gdc.test/compilable/ddoc13502.d @@ -1,5 +1,5 @@ // PERMUTE_ARGS: -// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -wi -o- +// REQUIRED_ARGS: -verrors=simple -D -Dd${RESULTS_DIR}/compilable -wi -o- /* TEST_OUTPUT: --- diff --git a/gcc/testsuite/gdc.test/compilable/ddoc4899.d b/gcc/testsuite/gdc.test/compilable/ddoc4899.d index b5cfa86..44999dd 100644 --- a/gcc/testsuite/gdc.test/compilable/ddoc4899.d +++ b/gcc/testsuite/gdc.test/compilable/ddoc4899.d @@ -1,5 +1,5 @@ // PERMUTE_ARGS: -// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -wi -o- +// REQUIRED_ARGS: -verrors=simple -D -Dd${RESULTS_DIR}/compilable -wi -o- /* TEST_OUTPUT: diff --git a/gcc/testsuite/gdc.test/compilable/depmsg.d b/gcc/testsuite/gdc.test/compilable/depmsg.d index 9b005d8..2c29e05 100644 --- a/gcc/testsuite/gdc.test/compilable/depmsg.d +++ b/gcc/testsuite/gdc.test/compilable/depmsg.d @@ -1,5 +1,5 @@ /* -REQUIRED_ARGS: -dw +REQUIRED_ARGS: -verrors=simple -dw TEST_OUTPUT: --- compilable/depmsg.d(39): Deprecation: struct `depmsg.main.Inner.A` is deprecated - With message! diff --git a/gcc/testsuite/gdc.test/compilable/deprecated_override.d b/gcc/testsuite/gdc.test/compilable/deprecated_override.d index c9da34d..193cea9 100644 --- a/gcc/testsuite/gdc.test/compilable/deprecated_override.d +++ b/gcc/testsuite/gdc.test/compilable/deprecated_override.d @@ -1,5 +1,5 @@ // https://issues.dlang.org/show_bug.cgi?id=22668 - +// REQUIRED_ARGS: -verrors=simple // Overrides with same deprecated'ness are allowed class SameParent diff --git a/gcc/testsuite/gdc.test/compilable/deprecationlimit.d b/gcc/testsuite/gdc.test/compilable/deprecationlimit.d index 8ee7ab6..2b7d45c 100644 --- a/gcc/testsuite/gdc.test/compilable/deprecationlimit.d +++ b/gcc/testsuite/gdc.test/compilable/deprecationlimit.d @@ -1,5 +1,5 @@ /* -REQUIRED_ARGS: -verrors=3 +REQUIRED_ARGS: -verrors=simple -verrors=3 TEST_OUTPUT: --- compilable/deprecationlimit.d(18): Deprecation: function `deprecationlimit.f` is deprecated diff --git a/gcc/testsuite/gdc.test/compilable/dtoh_invalid_identifiers.d b/gcc/testsuite/gdc.test/compilable/dtoh_invalid_identifiers.d index 28c7908..1179f66 100644 --- a/gcc/testsuite/gdc.test/compilable/dtoh_invalid_identifiers.d +++ b/gcc/testsuite/gdc.test/compilable/dtoh_invalid_identifiers.d @@ -1,5 +1,5 @@ /+ -REQUIRED_ARGS: -HC -c -o- -wi -extern-std=c++20 +REQUIRED_ARGS: -verrors=simple -HC -c -o- -wi -extern-std=c++20 PERMUTE_ARGS: TEST_OUTPUT: --- diff --git a/gcc/testsuite/gdc.test/compilable/interpret3.d b/gcc/testsuite/gdc.test/compilable/interpret3.d index 69f65b1..aa88458 100644 --- a/gcc/testsuite/gdc.test/compilable/interpret3.d +++ b/gcc/testsuite/gdc.test/compilable/interpret3.d @@ -1,8 +1,9 @@ // PERMUTE_ARGS: -inline +// REQUIRED_ARGS: -verrors=simple /* TEST_OUTPUT: --- -compilable/interpret3.d(6350): Deprecation: identity comparison of static arrays implicitly coerces them to slices, which are compared by reference +compilable/interpret3.d(6351): Deprecation: identity comparison of static arrays implicitly coerces them to slices, which are compared by reference --- */ diff --git a/gcc/testsuite/gdc.test/compilable/sw_transition_complex.d b/gcc/testsuite/gdc.test/compilable/sw_transition_complex.d index 3b27356..bcce94b 100644 --- a/gcc/testsuite/gdc.test/compilable/sw_transition_complex.d +++ b/gcc/testsuite/gdc.test/compilable/sw_transition_complex.d @@ -1,5 +1,5 @@ // PERMUTE_ARGS: -// REQUIRED_ARGS: -unittest -verrors=0 +// REQUIRED_ARGS: -verrors=simple -unittest -verrors=0 /* TEST_OUTPUT: diff --git a/gcc/testsuite/gdc.test/compilable/test12567c.d b/gcc/testsuite/gdc.test/compilable/test12567c.d index 9a686df..1e3f01b 100644 --- a/gcc/testsuite/gdc.test/compilable/test12567c.d +++ b/gcc/testsuite/gdc.test/compilable/test12567c.d @@ -1,4 +1,4 @@ -// REQUIRED_ARGS: +// REQUIRED_ARGS: -verrors=simple // EXTRA_FILES: imports/a12567.d // PERMUTE_ARGS: /* diff --git a/gcc/testsuite/gdc.test/compilable/test19227.d b/gcc/testsuite/gdc.test/compilable/test19227.d index 55fa591..2a1d325 100644 --- a/gcc/testsuite/gdc.test/compilable/test19227.d +++ b/gcc/testsuite/gdc.test/compilable/test19227.d @@ -1,7 +1,8 @@ // https://issues.dlang.org/show_bug.cgi?id=19227 +// REQUIRED_ARGS: -verrors=simple /* TEST_OUTPUT: --- -compilable/test19227.d(16): Deprecation: use of complex type `cfloat` is deprecated, use `std.complex.Complex!(float)` instead +compilable/test19227.d(17): Deprecation: use of complex type `cfloat` is deprecated, use `std.complex.Complex!(float)` instead Deprecation: use of complex type `const(cfloat)` is deprecated, use `std.complex.Complex!(float)` instead --- */ diff --git a/gcc/testsuite/gdc.test/compilable/test19609.d b/gcc/testsuite/gdc.test/compilable/test19609.d index df8f891..b23eece 100644 --- a/gcc/testsuite/gdc.test/compilable/test19609.d +++ b/gcc/testsuite/gdc.test/compilable/test19609.d @@ -1,11 +1,12 @@ // https://issues.dlang.org/show_bug.cgi?id=19609 +// REQUIRED_ARGS: -verrors=simple // EXTRA_FILES: imports/test19609a.d imports/test19609b.d imports/test19609c.d /* TEST_OUTPUT: --- -compilable/test19609.d(11): Deprecation: module `imports.test19609a` is deprecated -compilable/test19609.d(12): Deprecation: module `imports.test19609b` is deprecated - hello -compilable/test19609.d(13): Deprecation: module `imports.test19609c` is deprecated +compilable/test19609.d(12): Deprecation: module `imports.test19609a` is deprecated +compilable/test19609.d(13): Deprecation: module `imports.test19609b` is deprecated - hello +compilable/test19609.d(14): Deprecation: module `imports.test19609c` is deprecated --- */ import imports.test19609a; diff --git a/gcc/testsuite/gdc.test/compilable/test21514.d b/gcc/testsuite/gdc.test/compilable/test21514.d index 4eb8050..4ea5377 100644 --- a/gcc/testsuite/gdc.test/compilable/test21514.d +++ b/gcc/testsuite/gdc.test/compilable/test21514.d @@ -1,15 +1,16 @@ // https://issues.dlang.org/show_bug.cgi?id=21514 +// REQUIRED_ARGS: -verrors=simple // DISABLED: win32 win64 /* TEST_OUTPUT: --- -compilable/test21514.d(16): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead -compilable/test21514.d(16): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead -compilable/test21514.d(17): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead -compilable/test21514.d(17): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead -compilable/test21514.d(19): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead -compilable/test21514.d(19): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead -compilable/test21514.d(20): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead -compilable/test21514.d(20): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead +compilable/test21514.d(17): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead +compilable/test21514.d(17): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead +compilable/test21514.d(18): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead +compilable/test21514.d(18): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead +compilable/test21514.d(20): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead +compilable/test21514.d(20): Deprecation: use of complex type `cdouble` is deprecated, use `std.complex.Complex!(double)` instead +compilable/test21514.d(21): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead +compilable/test21514.d(21): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead --- */ diff --git a/gcc/testsuite/gdc.test/compilable/test23097.d b/gcc/testsuite/gdc.test/compilable/test23097.d index 092bd77..333b2f2 100644 --- a/gcc/testsuite/gdc.test/compilable/test23097.d +++ b/gcc/testsuite/gdc.test/compilable/test23097.d @@ -1,5 +1,5 @@ /* https://issues.dlang.org/show_bug.cgi?id=23097 -REQUIRED_ARGS: -verrors=spec +REQUIRED_ARGS: -verrors=simple -verrors=spec TEST_OUTPUT: --- (spec:2) compilable/test23097.d(14): Error: `inout` constructor `test23097.S23097.this` creates const object, not mutable diff --git a/gcc/testsuite/gdc.test/compilable/test9701.d b/gcc/testsuite/gdc.test/compilable/test9701.d index 68055c4..81b56bd 100644 --- a/gcc/testsuite/gdc.test/compilable/test9701.d +++ b/gcc/testsuite/gdc.test/compilable/test9701.d @@ -1,9 +1,10 @@ // https://issues.dlang.org/show_bug.cgi?id=9701 +// REQUIRED_ARGS: -verrors=simple /* TEST_OUTPUT: --- -compilable/test9701.d(68): Deprecation: enum member `test9701.Enum.value7` is deprecated -compilable/test9701.d(68): Deprecation: enum member `test9701.Enum.value8` is deprecated - message +compilable/test9701.d(69): Deprecation: enum member `test9701.Enum.value7` is deprecated +compilable/test9701.d(69): Deprecation: enum member `test9701.Enum.value8` is deprecated - message --- */ diff --git a/gcc/testsuite/gdc.test/compilable/udamodule1.d b/gcc/testsuite/gdc.test/compilable/udamodule1.d index 434cf51..76e9fb7 100644 --- a/gcc/testsuite/gdc.test/compilable/udamodule1.d +++ b/gcc/testsuite/gdc.test/compilable/udamodule1.d @@ -1,4 +1,4 @@ -// REQUIRED_ARGS: +// REQUIRED_ARGS: -verrors=simple // PERMUTE_ARGS: // EXTRA_FILES: imports/udamodule1.d /* diff --git a/gcc/testsuite/gdc.test/compilable/verrors_spec.d b/gcc/testsuite/gdc.test/compilable/verrors_spec.d index b858008..9768ba1 100644 --- a/gcc/testsuite/gdc.test/compilable/verrors_spec.d +++ b/gcc/testsuite/gdc.test/compilable/verrors_spec.d @@ -1,6 +1,6 @@ /* PERMUTE_ARGS: -REQUIRED_ARGS: -verrors=spec +REQUIRED_ARGS: -verrors=simple -verrors=spec TEST_OUTPUT: --- (spec:1) compilable/verrors_spec.d(13): Error: cannot implicitly convert expression `& i` of type `int*` to `int` diff --git a/gcc/testsuite/gdc.test/fail_compilation/attributediagnostic.d b/gcc/testsuite/gdc.test/fail_compilation/attributediagnostic.d index 523a183..da7f8ed 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/attributediagnostic.d +++ b/gcc/testsuite/gdc.test/fail_compilation/attributediagnostic.d @@ -5,11 +5,11 @@ fail_compilation/attributediagnostic.d(24): Error: `@safe` function `attributedi fail_compilation/attributediagnostic.d(26): which calls `attributediagnostic.layer0` fail_compilation/attributediagnostic.d(28): which calls `attributediagnostic.system` fail_compilation/attributediagnostic.d(30): which wasn't inferred `@safe` because of: -fail_compilation/attributediagnostic.d(30): `asm` statement is assumed to be `@system` - mark it with `@trusted` if it is not +fail_compilation/attributediagnostic.d(30): `asm` statement without `@trusted` annotation fail_compilation/attributediagnostic.d(25): `attributediagnostic.layer1` is declared here fail_compilation/attributediagnostic.d(46): Error: `@safe` function `D main` cannot call `@system` function `attributediagnostic.system1` fail_compilation/attributediagnostic.d(35): which wasn't inferred `@safe` because of: -fail_compilation/attributediagnostic.d(35): cast from `uint` to `int*` not allowed in safe code +fail_compilation/attributediagnostic.d(35): cast from `uint` to `int*` fail_compilation/attributediagnostic.d(33): `attributediagnostic.system1` is declared here fail_compilation/attributediagnostic.d(47): Error: `@safe` function `D main` cannot call `@system` function `attributediagnostic.system2` fail_compilation/attributediagnostic.d(41): which wasn't inferred `@safe` because of: diff --git a/gcc/testsuite/gdc.test/fail_compilation/bool_cast.d b/gcc/testsuite/gdc.test/fail_compilation/bool_cast.d index 830360a..e648429 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/bool_cast.d +++ b/gcc/testsuite/gdc.test/fail_compilation/bool_cast.d @@ -2,11 +2,11 @@ REQUIRED_ARGS: -de -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/bool_cast.d(17): Deprecation: cast from `ubyte[]` to `bool[]` not allowed in safe code +fail_compilation/bool_cast.d(17): Deprecation: cast from `ubyte[]` to `bool[]` will become `@system` in a future release fail_compilation/bool_cast.d(17): Source element may have bytes which are not 0 or 1 -fail_compilation/bool_cast.d(22): Deprecation: cast from `int*` to `bool*` not allowed in safe code +fail_compilation/bool_cast.d(22): Deprecation: cast from `int*` to `bool*` will become `@system` in a future release fail_compilation/bool_cast.d(22): Source element may have bytes which are not 0 or 1 -fail_compilation/bool_cast.d(24): Deprecation: cast from `bool*` to `byte*` not allowed in safe code +fail_compilation/bool_cast.d(24): Deprecation: cast from `bool*` to `byte*` will become `@system` in a future release fail_compilation/bool_cast.d(24): Target element could be assigned a byte which is not 0 or 1 --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/bug19569.d b/gcc/testsuite/gdc.test/fail_compilation/bug19569.d index a314142..1bf6fb5 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/bug19569.d +++ b/gcc/testsuite/gdc.test/fail_compilation/bug19569.d @@ -1,51 +1,51 @@ /* TEST_OUTPUT: --- -fail_compilation/bug19569.d(70): Error: `bug19569.test0` called with argument types `()` matches both: +fail_compilation/bug19569.d(70): Error: `bug19569.test0` called with argument types `()` matches multiple overloads exactly: fail_compilation/bug19569.d(56): `bug19569.test0()` and: fail_compilation/bug19569.d(57): `bug19569.test0()` -fail_compilation/bug19569.d(71): Error: `bug19569.test1` called with argument types `()` matches both: +fail_compilation/bug19569.d(71): Error: `bug19569.test1` called with argument types `()` matches multiple overloads exactly: fail_compilation/bug19569.d(59): `bug19569.test1()` and: fail_compilation/bug19569.d(60): `bug19569.test1()` -fail_compilation/bug19569.d(72): Error: `bug19569.test2` called with argument types `()` matches both: +fail_compilation/bug19569.d(72): Error: `bug19569.test2` called with argument types `()` matches multiple overloads exactly: fail_compilation/bug19569.d(62): `bug19569.test2!().test2()` and: fail_compilation/bug19569.d(63): `bug19569.test2!().test2()` -fail_compilation/bug19569.d(73): Error: `bug19569.test3` called with argument types `()` matches both: +fail_compilation/bug19569.d(73): Error: `bug19569.test3` called with argument types `()` matches multiple overloads exactly: fail_compilation/bug19569.d(65): `bug19569.test3!().test3()` and: fail_compilation/bug19569.d(66): `bug19569.test3!().test3()` -fail_compilation/bug19569.d(78): Error: `bug19569.test0` called with argument types `()` matches both: +fail_compilation/bug19569.d(78): Error: `bug19569.test0` called with argument types `()` matches multiple overloads exactly: fail_compilation/bug19569.d(56): `bug19569.test0()` and: fail_compilation/bug19569.d(57): `bug19569.test0()` -fail_compilation/bug19569.d(79): Error: `bug19569.test1` called with argument types `()` matches both: +fail_compilation/bug19569.d(79): Error: `bug19569.test1` called with argument types `()` matches multiple overloads exactly: fail_compilation/bug19569.d(59): `bug19569.test1()` and: fail_compilation/bug19569.d(60): `bug19569.test1()` -fail_compilation/bug19569.d(80): Error: `bug19569.test2` called with argument types `()` matches both: +fail_compilation/bug19569.d(80): Error: `bug19569.test2` called with argument types `()` matches multiple overloads exactly: fail_compilation/bug19569.d(62): `bug19569.test2!().test2()` and: fail_compilation/bug19569.d(63): `bug19569.test2!().test2()` -fail_compilation/bug19569.d(81): Error: `bug19569.test3` called with argument types `()` matches both: +fail_compilation/bug19569.d(81): Error: `bug19569.test3` called with argument types `()` matches multiple overloads exactly: fail_compilation/bug19569.d(65): `bug19569.test3!().test3()` and: fail_compilation/bug19569.d(66): `bug19569.test3!().test3()` -fail_compilation/bug19569.d(86): Error: `bug19569.test0` called with argument types `()` matches both: +fail_compilation/bug19569.d(86): Error: `bug19569.test0` called with argument types `()` matches multiple overloads exactly: fail_compilation/bug19569.d(56): `bug19569.test0()` and: fail_compilation/bug19569.d(57): `bug19569.test0()` -fail_compilation/bug19569.d(87): Error: `bug19569.test1` called with argument types `()` matches both: +fail_compilation/bug19569.d(87): Error: `bug19569.test1` called with argument types `()` matches multiple overloads exactly: fail_compilation/bug19569.d(59): `bug19569.test1()` and: fail_compilation/bug19569.d(60): `bug19569.test1()` -fail_compilation/bug19569.d(88): Error: `bug19569.test2` called with argument types `()` matches both: +fail_compilation/bug19569.d(88): Error: `bug19569.test2` called with argument types `()` matches multiple overloads exactly: fail_compilation/bug19569.d(62): `bug19569.test2!().test2()` and: fail_compilation/bug19569.d(63): `bug19569.test2!().test2()` -fail_compilation/bug19569.d(89): Error: `bug19569.test3` called with argument types `()` matches both: +fail_compilation/bug19569.d(89): Error: `bug19569.test3` called with argument types `()` matches multiple overloads exactly: fail_compilation/bug19569.d(65): `bug19569.test3!().test3()` and: fail_compilation/bug19569.d(66): `bug19569.test3!().test3()` diff --git a/gcc/testsuite/gdc.test/fail_compilation/cast_qual.d b/gcc/testsuite/gdc.test/fail_compilation/cast_qual.d index 5821dc1..500724d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/cast_qual.d +++ b/gcc/testsuite/gdc.test/fail_compilation/cast_qual.d @@ -2,9 +2,9 @@ REQUIRED_ARGS: -preview=dip1000 -de TEST_OUTPUT: --- -fail_compilation/cast_qual.d(17): Deprecation: cast from `const(int)` to `int` cannot be used as an lvalue in @safe code -fail_compilation/cast_qual.d(19): Deprecation: cast from `const(int)` to `int` cannot be used as an lvalue in @safe code -fail_compilation/cast_qual.d(25): Error: cast from `const(Object)` to `object.Object` not allowed in safe code +fail_compilation/cast_qual.d(17): Deprecation: using the result of a cast from `const(int)` to `int` as an lvalue will become `@system` in a future release +fail_compilation/cast_qual.d(19): Deprecation: using the result of a cast from `const(int)` to `int` as an lvalue will become `@system` in a future release +fail_compilation/cast_qual.d(25): Error: cast from `const(Object)` to `object.Object` is not allowed in a `@safe` function fail_compilation/cast_qual.d(25): Incompatible type qualifier --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/cpp_cast.d b/gcc/testsuite/gdc.test/fail_compilation/cpp_cast.d index 3802ebd..3fc82b1 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/cpp_cast.d +++ b/gcc/testsuite/gdc.test/fail_compilation/cpp_cast.d @@ -3,9 +3,9 @@ REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/cpp_cast.d(19): Error: cast from `cpp_cast.I` to `cpp_cast.C` not allowed in safe code +fail_compilation/cpp_cast.d(19): Error: cast from `cpp_cast.I` to `cpp_cast.C` is not allowed in a `@safe` function fail_compilation/cpp_cast.d(19): No dynamic type information for extern(C++) classes -fail_compilation/cpp_cast.d(21): Deprecation: cast from `cpp_cast.C` to `cpp_cast.D` not allowed in safe code +fail_compilation/cpp_cast.d(21): Deprecation: cast from `cpp_cast.C` to `cpp_cast.D` will become `@system` in a future release fail_compilation/cpp_cast.d(21): No dynamic type information for extern(C++) classes --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/cppeh1.d b/gcc/testsuite/gdc.test/fail_compilation/cppeh1.d index 9ef0ab3..c64d3bf 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/cppeh1.d +++ b/gcc/testsuite/gdc.test/fail_compilation/cppeh1.d @@ -2,7 +2,7 @@ /* TEST_OUTPUT: --- -fail_compilation/cppeh1.d(26): Error: cannot catch C++ class objects in `@safe` code +fail_compilation/cppeh1.d(26): Error: catching C++ class objects is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10319.d b/gcc/testsuite/gdc.test/fail_compilation/diag10319.d index efc818f..78bd57f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag10319.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag10319.d @@ -9,7 +9,7 @@ fail_compilation/diag10319.d(26): which wasn't inferred `pure` because of fail_compilation/diag10319.d(26): `pure` function `diag10319.bar!int.bar` cannot access mutable static data `g` fail_compilation/diag10319.d(34): Error: `@safe` function `D main` cannot call `@system` function `diag10319.bar!int.bar` fail_compilation/diag10319.d(27): which wasn't inferred `@safe` because of: -fail_compilation/diag10319.d(27): cannot take address of local `x` in `@safe` function `bar` +fail_compilation/diag10319.d(27): taking the address of stack-allocated local variable `x` fail_compilation/diag10319.d(24): `diag10319.bar!int.bar` is declared here fail_compilation/diag10319.d(33): Error: function `diag10319.foo` is not `nothrow` fail_compilation/diag10319.d(34): Error: function `diag10319.bar!int.bar` is not `nothrow` diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag10359.d b/gcc/testsuite/gdc.test/fail_compilation/diag10359.d index 142cec9..39a7877 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag10359.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag10359.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/diag10359.d(10): Error: pointer slicing not allowed in safe functions +fail_compilation/diag10359.d(10): Error: pointer slicing is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11769.d b/gcc/testsuite/gdc.test/fail_compilation/diag11769.d index 75047f5..9f9ed35 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag11769.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag11769.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/diag11769.d(18): Error: `diag11769.foo!string.bar` called with argument types `(string)` matches both: +fail_compilation/diag11769.d(18): Error: `diag11769.foo!string.bar` called with argument types `(string)` matches multiple overloads after implicit conversions: fail_compilation/diag11769.d(13): `diag11769.foo!string.bar(wstring __param_0)` and: fail_compilation/diag11769.d(14): `diag11769.foo!string.bar(dstring __param_0)` diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag23295.d b/gcc/testsuite/gdc.test/fail_compilation/diag23295.d index a0bfe88..4f996b6 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag23295.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag23295.d @@ -2,10 +2,10 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/diag23295.d(21): Error: scope variable `x` assigned to non-scope parameter `y` calling `foo` +fail_compilation/diag23295.d(21): Error: assigning scope variable `x` to non-scope parameter `y` calling `foo` is not allowed in a `@safe` function fail_compilation/diag23295.d(32): which is assigned to non-scope parameter `z` fail_compilation/diag23295.d(34): which is not `scope` because of `f = & z` -fail_compilation/diag23295.d(24): Error: scope variable `ex` assigned to non-scope parameter `e` calling `thro` +fail_compilation/diag23295.d(24): Error: assigning scope variable `ex` to non-scope parameter `e` calling `thro` is not allowed in a `@safe` function fail_compilation/diag23295.d(39): which is not `scope` because of `throw e` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/dip25.d b/gcc/testsuite/gdc.test/fail_compilation/dip25.d index f43a6e9e..f17e5e1 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/dip25.d +++ b/gcc/testsuite/gdc.test/fail_compilation/dip25.d @@ -2,10 +2,10 @@ REQUIRED_ARGS: TEST_OUTPUT: --- -fail_compilation/dip25.d(17): Error: returning `this.buffer[]` escapes a reference to parameter `this` +fail_compilation/dip25.d(17): Error: escaping a reference to parameter `this` by returning `this.buffer[]` is not allowed in a `@safe` function fail_compilation/dip25.d(15): perhaps annotate the function with `return` fail_compilation/dip25.d(22): Error: returning `identity(x)` escapes a reference to parameter `x` -fail_compilation/dip25.d(23): Error: returning `identity(x)` escapes a reference to parameter `x` +fail_compilation/dip25.d(23): Error: escaping a reference to parameter `x` by returning `identity(x)` is not allowed in a `@safe` function fail_compilation/dip25.d(23): perhaps annotate the parameter with `return` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14554.d b/gcc/testsuite/gdc.test/fail_compilation/fail14554.d index b71a68e..26f6f16 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail14554.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail14554.d @@ -3,11 +3,11 @@ /* TEST_OUTPUT: --- -fail_compilation/fail14554.d(28): Error: `fail14554.issue14554_1.foo` called with argument types `(int)` matches both: +fail_compilation/fail14554.d(28): Error: `fail14554.issue14554_1.foo` called with argument types `(int)` matches multiple overloads exactly: fail_compilation/fail14554.d(17): `fail14554.issue14554_1.foo!bool.foo(int j)` and: fail_compilation/fail14554.d(18): `fail14554.issue14554_1.foo!bool.foo(int j)` -fail_compilation/fail14554.d(29): Error: `fail14554.issue14554_2.foo` called with argument types `(int)` matches both: +fail_compilation/fail14554.d(29): Error: `fail14554.issue14554_2.foo` called with argument types `(int)` matches multiple overloads exactly: fail_compilation/fail14554.d(22): `fail14554.issue14554_2.foo!bool.foo(int j)` and: fail_compilation/fail14554.d(23): `fail14554.issue14554_2.foo!bool.foo(int j)` diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail16600.d b/gcc/testsuite/gdc.test/fail_compilation/fail16600.d index 3bd600e..025d93f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail16600.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail16600.d @@ -1,6 +1,6 @@ /* TEST_OUTPUT: --- -fail_compilation/fail16600.d(22): Error: `fail16600.S.__ctor` called with argument types `(string) const` matches both: +fail_compilation/fail16600.d(22): Error: `fail16600.S.__ctor` called with argument types `(string) const` matches multiple overloads exactly: fail_compilation/fail16600.d(16): `fail16600.S.this(string __param_0)` and: fail_compilation/fail16600.d(17): `fail16600.S.this(string __param_0) immutable` diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail17842.d b/gcc/testsuite/gdc.test/fail_compilation/fail17842.d index 734f8d7..ff801a1 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail17842.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail17842.d @@ -1,8 +1,8 @@ /* REQUIRED_ARGS: -preview=dip1000 * TEST_OUTPUT: --- -fail_compilation/fail17842.d(14): Error: scope variable `p` assigned to non-scope `*q` -fail_compilation/fail17842.d(23): Error: scope variable `obj` may not be copied into allocated memory +fail_compilation/fail17842.d(14): Error: assigning scope variable `p` to non-scope `*q` is not allowed in a `@safe` function +fail_compilation/fail17842.d(23): Error: copying scope variable `obj` into allocated memory is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19729.d b/gcc/testsuite/gdc.test/fail_compilation/fail19729.d index 5943d08..6fd9045 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail19729.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail19729.d @@ -1,11 +1,11 @@ /* TEST_OUTPUT: --- -fail_compilation/fail19729.d(35): Error: `fail19729.C.__ctor` called with argument types `(string)` matches both: +fail_compilation/fail19729.d(35): Error: `fail19729.C.__ctor` called with argument types `(string)` matches multiple overloads exactly: fail_compilation/fail19729.d(18): `fail19729.C.Templ!string.this(string t)` and: fail_compilation/fail19729.d(18): `fail19729.C.Templ!string.this(string t)` -fail_compilation/fail19729.d(36): Error: `fail19729.D.__ctor` called with argument types `(string)` matches both: +fail_compilation/fail19729.d(36): Error: `fail19729.D.__ctor` called with argument types `(string)` matches multiple overloads after qualifier conversion: fail_compilation/fail19729.d(18): `fail19729.D.Templ!(const(char)[]).this(const(char)[] t)` and: fail_compilation/fail19729.d(18): `fail19729.D.Templ!(const(char)*).this(const(char)* t)` diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19881.d b/gcc/testsuite/gdc.test/fail_compilation/fail19881.d index 62f3dc4..f059ebf 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail19881.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail19881.d @@ -1,8 +1,8 @@ /* REQUIRED_ARGS: -preview=dip1000 * TEST_OUTPUT: --- -fail_compilation/fail19881.d(13): Error: address of local variable `local` assigned to return scope `input` -fail_compilation/fail19881.d(13): Error: address of variable `local` assigned to `input` with longer lifetime +fail_compilation/fail19881.d(13): Error: assigning address of local variable `local` to return scope `input` is not allowed in a `@safe` function +fail_compilation/fail19881.d(13): Error: assigning address of variable `local` to `input` with longer lifetime is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19965.d b/gcc/testsuite/gdc.test/fail_compilation/fail19965.d index b76a3a0..3128796 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail19965.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail19965.d @@ -2,7 +2,7 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/fail19965.d(36): Error: address of variable `f` assigned to `a` with longer lifetime +fail_compilation/fail19965.d(36): Error: assigning address of variable `f` to `a` with longer lifetime is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail20000.d b/gcc/testsuite/gdc.test/fail_compilation/fail20000.d index a049dac..8ef4e25 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail20000.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail20000.d @@ -1,29 +1,29 @@ /* TEST_OUTPUT: --- -fail_compilation/fail20000.d(37): Error: cast from `fail20000.DClass` to `fail20000.CppClass` not allowed in safe code +fail_compilation/fail20000.d(37): Error: cast from `fail20000.DClass` to `fail20000.CppClass` is not allowed in a `@safe` function fail_compilation/fail20000.d(37): Source object type is incompatible with target type -fail_compilation/fail20000.d(38): Error: cast from `fail20000.DInterface` to `fail20000.CppClass` not allowed in safe code +fail_compilation/fail20000.d(38): Error: cast from `fail20000.DInterface` to `fail20000.CppClass` is not allowed in a `@safe` function fail_compilation/fail20000.d(38): Source object type is incompatible with target type -fail_compilation/fail20000.d(39): Error: cast from `fail20000.CppClass2` to `fail20000.CppClass` not allowed in safe code +fail_compilation/fail20000.d(39): Error: cast from `fail20000.CppClass2` to `fail20000.CppClass` is not allowed in a `@safe` function fail_compilation/fail20000.d(39): Source object type is incompatible with target type -fail_compilation/fail20000.d(40): Error: cast from `fail20000.CppInterface2` to `fail20000.CppClass` not allowed in safe code +fail_compilation/fail20000.d(40): Error: cast from `fail20000.CppInterface2` to `fail20000.CppClass` is not allowed in a `@safe` function fail_compilation/fail20000.d(40): Source object type is incompatible with target type -fail_compilation/fail20000.d(42): Error: cast from `fail20000.DClass` to `fail20000.CppInterface` not allowed in safe code +fail_compilation/fail20000.d(42): Error: cast from `fail20000.DClass` to `fail20000.CppInterface` is not allowed in a `@safe` function fail_compilation/fail20000.d(42): Source object type is incompatible with target type -fail_compilation/fail20000.d(43): Error: cast from `fail20000.DInterface` to `fail20000.CppInterface` not allowed in safe code +fail_compilation/fail20000.d(43): Error: cast from `fail20000.DInterface` to `fail20000.CppInterface` is not allowed in a `@safe` function fail_compilation/fail20000.d(43): Source object type is incompatible with target type -fail_compilation/fail20000.d(44): Error: cast from `fail20000.CppClass2` to `fail20000.CppInterface` not allowed in safe code +fail_compilation/fail20000.d(44): Error: cast from `fail20000.CppClass2` to `fail20000.CppInterface` is not allowed in a `@safe` function fail_compilation/fail20000.d(44): Source object type is incompatible with target type -fail_compilation/fail20000.d(45): Error: cast from `fail20000.CppInterface2` to `fail20000.CppInterface` not allowed in safe code +fail_compilation/fail20000.d(45): Error: cast from `fail20000.CppInterface2` to `fail20000.CppInterface` is not allowed in a `@safe` function fail_compilation/fail20000.d(45): Source object type is incompatible with target type -fail_compilation/fail20000.d(47): Error: cast from `fail20000.CppClass` to `fail20000.DClass` not allowed in safe code +fail_compilation/fail20000.d(47): Error: cast from `fail20000.CppClass` to `fail20000.DClass` is not allowed in a `@safe` function fail_compilation/fail20000.d(47): Source object type is incompatible with target type -fail_compilation/fail20000.d(48): Error: cast from `fail20000.CppInterface` to `fail20000.DClass` not allowed in safe code +fail_compilation/fail20000.d(48): Error: cast from `fail20000.CppInterface` to `fail20000.DClass` is not allowed in a `@safe` function fail_compilation/fail20000.d(48): Source object type is incompatible with target type -fail_compilation/fail20000.d(50): Error: cast from `fail20000.CppClass` to `fail20000.DInterface` not allowed in safe code +fail_compilation/fail20000.d(50): Error: cast from `fail20000.CppClass` to `fail20000.DInterface` is not allowed in a `@safe` function fail_compilation/fail20000.d(50): Source object type is incompatible with target type -fail_compilation/fail20000.d(51): Error: cast from `fail20000.CppInterface` to `fail20000.DInterface` not allowed in safe code +fail_compilation/fail20000.d(51): Error: cast from `fail20000.CppInterface` to `fail20000.DInterface` is not allowed in a `@safe` function fail_compilation/fail20000.d(51): Source object type is incompatible with target type --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail20084.d b/gcc/testsuite/gdc.test/fail_compilation/fail20084.d index 22f6433..f3f52fe 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail20084.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail20084.d @@ -1,7 +1,7 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/fail20084.d(109): Error: returning `v.front()` escapes a reference to parameter `v` +fail_compilation/fail20084.d(109): Error: escaping a reference to parameter `v` by returning `v.front()` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail20108.d b/gcc/testsuite/gdc.test/fail_compilation/fail20108.d index 15845e1..f2130f3 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail20108.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail20108.d @@ -2,10 +2,10 @@ /* TEST_OUTPUT: --- -fail_compilation/fail20108.d(15): Error: address of variable `y` assigned to `x` with longer lifetime +fail_compilation/fail20108.d(15): Error: assigning address of variable `y` to `x` with longer lifetime is not allowed in a `@safe` function fail_compilation/fail20108.d(16): Error: scope parameter `x` may not be returned -fail_compilation/fail20108.d(23): Error: address of variable `y` assigned to `x` with longer lifetime -fail_compilation/fail20108.d(24): Error: scope variable `x` may not be returned +fail_compilation/fail20108.d(23): Error: assigning address of variable `y` to `x` with longer lifetime is not allowed in a `@safe` function +fail_compilation/fail20108.d(24): Error: returning scope variable `x` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail20183.d b/gcc/testsuite/gdc.test/fail_compilation/fail20183.d index 9d99212..b0e4cc7 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail20183.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail20183.d @@ -4,8 +4,6 @@ TEST_OUTPUT: fail_compilation/fail20183.d(1016): Error: function `addr` is not callable using argument types `(int)` fail_compilation/fail20183.d(1016): cannot pass rvalue argument `S(0).i` of type `int` to parameter `return ref int b` fail_compilation/fail20183.d(1004): `fail20183.addr(return ref int b)` declared here -fail_compilation/fail20183.d(1017): Error: address of expression temporary returned by `s()` assigned to `q` with longer lifetime -fail_compilation/fail20183.d(1018): Error: address of struct literal `S(0)` assigned to `r` with longer lifetime --- */ @@ -34,7 +32,9 @@ void test() /* TEST_OUTPUT: --- -fail_compilation/fail20183.d(1107): Error: address of expression temporary returned by `s()` assigned to `this.ptr` with longer lifetime +fail_compilation/fail20183.d(1017): Error: assigning address of expression temporary returned by `s()` to `q` with longer lifetime is not allowed in a `@safe` function +fail_compilation/fail20183.d(1018): Error: assigning address of struct literal `S(0)` to `r` with longer lifetime is not allowed in a `@safe` function +fail_compilation/fail20183.d(1107): Error: assigning address of expression temporary returned by `s()` to `this.ptr` with longer lifetime is not allowed in a `@safe` function --- */ #line 1100 diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail20461.d b/gcc/testsuite/gdc.test/fail_compilation/fail20461.d index 77c7178..9fe453c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail20461.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail20461.d @@ -1,7 +1,7 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/fail20461.d(106): Error: reference to local variable `buffer` assigned to non-scope parameter calling `assert()` +fail_compilation/fail20461.d(106): Error: assigningreference to local variable `buffer` to non-scope parameter calling `assert()` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail20551.d b/gcc/testsuite/gdc.test/fail_compilation/fail20551.d index 633be0a..b2b0429 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail20551.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail20551.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail20551.d(15): Error: cannot take address of lazy parameter `e` in `@safe` function `opAssign` +fail_compilation/fail20551.d(15): Error: taking address of lazy parameter `e` is not allowed in a `@safe` function fail_compilation/fail20551.d(26): Error: template instance `fail20551.LazyStore!int.LazyStore.opAssign!int` error instantiating --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail20658.d b/gcc/testsuite/gdc.test/fail_compilation/fail20658.d index fd422aa..0f48ba7 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail20658.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail20658.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail20658.d(14): Error: field `U.m` cannot modify fields in `@safe` code that overlap fields with other storage classes +fail_compilation/fail20658.d(14): Error: modifying field `U.m` which overlaps with fields with other storage classes is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail20691.d b/gcc/testsuite/gdc.test/fail_compilation/fail20691.d index 54e36fc..240b2ca 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail20691.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail20691.d @@ -1,9 +1,9 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/fail20691.d(106): Error: cannot take address of `scope` variable `sa` since `scope` applies to first indirection only -fail_compilation/fail20691.d(107): Error: cannot take address of `scope` variable `sa` since `scope` applies to first indirection only -fail_compilation/fail20691.d(108): Error: cannot take address of `scope` variable `sa` since `scope` applies to first indirection only +fail_compilation/fail20691.d(106): Error: taking address of `scope` variable `sa` with pointers is not allowed in a `@safe` function +fail_compilation/fail20691.d(107): Error: taking address of `scope` variable `sa` with pointers is not allowed in a `@safe` function +fail_compilation/fail20691.d(108): Error: taking address of `scope` variable `sa` with pointers is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail21868b.d b/gcc/testsuite/gdc.test/fail_compilation/fail21868b.d index 0df31d7..802ceaf 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail21868b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail21868b.d @@ -1,7 +1,7 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/fail21868b.d(19): Error: returning `&s.x` escapes a reference to parameter `s` +fail_compilation/fail21868b.d(19): Error: escaping a reference to parameter `s` by returning `&s.x` is not allowed in a `@safe` function fail_compilation/fail21868b.d(17): perhaps change the `return scope` into `scope return` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail22138.d b/gcc/testsuite/gdc.test/fail_compilation/fail22138.d index 4fee96f..f4ba879 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail22138.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail22138.d @@ -1,7 +1,7 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/fail22138.d(107): Error: scope variable `e` may not be returned +fail_compilation/fail22138.d(107): Error: returning scope variable `e` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail22157.d b/gcc/testsuite/gdc.test/fail_compilation/fail22157.d index d25aaad..8a14423 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail22157.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail22157.d @@ -3,11 +3,11 @@ /* TEST_OUTPUT: --- -fail_compilation/fail22157.d(32): Error: `fail22157.S!true.S.foo` called with argument types `()` matches both: +fail_compilation/fail22157.d(32): Error: `fail22157.S!true.S.foo` called with argument types `()` matches multiple overloads exactly: fail_compilation/fail22157.d(21): `fail22157.S!true.S.foo()` and: fail_compilation/fail22157.d(22): `fail22157.S!true.S.foo()` -fail_compilation/fail22157.d(33): Error: `fail22157.S!false.S.foo` called with argument types `()` matches both: +fail_compilation/fail22157.d(33): Error: `fail22157.S!false.S.foo` called with argument types `()` matches multiple overloads exactly: fail_compilation/fail22157.d(26): `fail22157.S!false.S.foo()` and: fail_compilation/fail22157.d(27): `fail22157.S!false.S.foo()` diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail22366.d b/gcc/testsuite/gdc.test/fail_compilation/fail22366.d index 675ba83..5be7d3e 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail22366.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail22366.d @@ -2,13 +2,13 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/fail22366.d(22): Error: scope variable `s` may not be copied into allocated memory -fail_compilation/fail22366.d(25): Error: scope variable `s` may not be copied into allocated memory -fail_compilation/fail22366.d(26): Error: scope variable `s` may not be copied into allocated memory -fail_compilation/fail22366.d(27): Error: scope variable `s` may not be copied into allocated memory -fail_compilation/fail22366.d(28): Error: scope variable `s` may not be copied into allocated memory -fail_compilation/fail22366.d(31): Error: scope variable `s` may not be copied into allocated memory -fail_compilation/fail22366.d(32): Error: scope variable `s` may not be copied into allocated memory +fail_compilation/fail22366.d(22): Error: copying scope variable `s` into allocated memory is not allowed in a `@safe` function +fail_compilation/fail22366.d(25): Error: copying scope variable `s` into allocated memory is not allowed in a `@safe` function +fail_compilation/fail22366.d(26): Error: copying scope variable `s` into allocated memory is not allowed in a `@safe` function +fail_compilation/fail22366.d(27): Error: copying scope variable `s` into allocated memory is not allowed in a `@safe` function +fail_compilation/fail22366.d(28): Error: copying scope variable `s` into allocated memory is not allowed in a `@safe` function +fail_compilation/fail22366.d(31): Error: copying scope variable `s` into allocated memory is not allowed in a `@safe` function +fail_compilation/fail22366.d(32): Error: copying scope variable `s` into allocated memory is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail23626b.d b/gcc/testsuite/gdc.test/fail_compilation/fail23626b.d index 758a28b..55ed42d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail23626b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail23626b.d @@ -1,6 +1,6 @@ /* TEST_OUTPUT: --- -fail_compilation/fail23626b.d(26): Error: `fail23626b.AmbigOpApply.opApply` called with argument types `(int delegate(int i) pure nothrow @nogc @system)` matches both: +fail_compilation/fail23626b.d(26): Error: `fail23626b.AmbigOpApply.opApply` called with argument types `(int delegate(int i) pure nothrow @nogc @system)` matches multiple overloads after qualifier conversion: fail_compilation/fail23626b.d(12): `fail23626b.AmbigOpApply.opApply(int delegate(int) dg)` and: fail_compilation/fail23626b.d(17): `fail23626b.AmbigOpApply.opApply(int delegate(int) dg)` diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail24208.d b/gcc/testsuite/gdc.test/fail_compilation/fail24208.d index 149c138..c39676a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail24208.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail24208.d @@ -2,7 +2,7 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/fail24208.d(19): Error: reference to local variable `n` assigned to non-scope parameter `p` calling `escape` +fail_compilation/fail24208.d(19): Error: assigning reference to local variable `n` to non-scope parameter `p` calling `escape` is not allowed in a `@safe` function fail_compilation/fail24208.d(15): which is not `scope` because of `escaped = p` --- +/ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail24212.d b/gcc/testsuite/gdc.test/fail_compilation/fail24212.d index 767951d..c8d2fc1 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail24212.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail24212.d @@ -2,7 +2,7 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/fail24212.d(29): Error: reference to local variable `n` assigned to non-scope parameter `p` calling `fun` +fail_compilation/fail24212.d(29): Error: assigning reference to local variable `n` to non-scope parameter `p` calling `fun` is not allowed in a `@safe` function --- +/ class Base diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail24213.d b/gcc/testsuite/gdc.test/fail_compilation/fail24213.d index e2af6fd..a6a75c8 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail24213.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail24213.d @@ -2,7 +2,7 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/fail24213.d(16): Error: reference to local variable `n` assigned to non-scope parameter `p` +fail_compilation/fail24213.d(16): Error: assigning reference to local variable `n` to non-scope parameter `p` is not allowed in a `@safe` function --- +/ alias Dg = void delegate(int* p) @safe pure nothrow; diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6497.d b/gcc/testsuite/gdc.test/fail_compilation/fail6497.d index 3ac90b5..00c66a6 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail6497.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail6497.d @@ -1,8 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail6497.d(12): Error: cannot take address of local `n` in `@safe` function `main` -fail_compilation/fail6497.d(12): Error: cannot take address of local `n` in `@safe` function `main` +fail_compilation/fail6497.d(12): Error: taking the address of stack-allocated local variable `n` is not allowed in a `@safe` function +fail_compilation/fail6497.d(12): Error: taking the address of stack-allocated local variable `n` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8313.d b/gcc/testsuite/gdc.test/fail_compilation/fail8313.d index 2badeff..9fac4fe 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail8313.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail8313.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail8313.d(13): Error: `fail8313.bar` called with argument types `(int)` matches both: +fail_compilation/fail8313.d(13): Error: `fail8313.bar` called with argument types `(int)` matches multiple overloads exactly: fail_compilation/fail8313.d(11): `fail8313.bar!().bar(int x)` and: fail_compilation/fail8313.d(12): `fail8313.bar!().bar(int x)` diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8373.d b/gcc/testsuite/gdc.test/fail_compilation/fail8373.d index 6f6337d..2d1d8a6 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail8373.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail8373.d @@ -1,11 +1,11 @@ /* TEST_OUTPUT: --- -fail_compilation/fail8373.d(21): Error: `fail8373.fun1` called with argument types `(int)` matches both: +fail_compilation/fail8373.d(21): Error: `fail8373.fun1` called with argument types `(int)` matches multiple overloads exactly: fail_compilation/fail8373.d(15): `fail8373.fun1!().fun1!int.fun1(int)` and: fail_compilation/fail8373.d(16): `fail8373.fun1!int.fun1(int)` -fail_compilation/fail8373.d(22): Error: `fail8373.fun2` called with argument types `(int)` matches both: +fail_compilation/fail8373.d(22): Error: `fail8373.fun2` called with argument types `(int)` matches multiple overloads exactly: fail_compilation/fail8373.d(18): `fail8373.fun2!int.fun2(int)` and: fail_compilation/fail8373.d(19): `fail8373.fun2!().fun2!int.fun2(int)` diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_pretty_errors.d b/gcc/testsuite/gdc.test/fail_compilation/fail_pretty_errors.d index e9533c0..2016a50 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail_pretty_errors.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail_pretty_errors.d @@ -2,20 +2,23 @@ REQUIRED_ARGS: -verrors=context TEST_OUTPUT: --- -fail_compilation/fail_pretty_errors.d(24): Error: undefined identifier `a` +fail_compilation/fail_pretty_errors.d(27): Error: undefined identifier `a` a = 1; ^ -fail_compilation/fail_pretty_errors.d-mixin-29(29): Error: undefined identifier `b` -fail_compilation/fail_pretty_errors.d(34): Error: cannot implicitly convert expression `5` of type `int` to `string` +fail_compilation/fail_pretty_errors.d-mixin-32(32): Error: undefined identifier `b` +fail_compilation/fail_pretty_errors.d(37): Error: cannot implicitly convert expression `5` of type `int` to `string` string x = 5; ^ -fail_compilation/fail_pretty_errors.d(39): Error: mixin `fail_pretty_errors.testMixin2.mixinTemplate!()` error instantiating +fail_compilation/fail_pretty_errors.d(42): Error: mixin `fail_pretty_errors.testMixin2.mixinTemplate!()` error instantiating mixin mixinTemplate; ^ -fail_compilation/fail_pretty_errors.d(45): Error: invalid array operation `"" + ""` (possible missing []) +fail_compilation/fail_pretty_errors.d(48): Error: invalid array operation `"" + ""` (possible missing []) auto x = ""+""; ^ -fail_compilation/fail_pretty_errors.d(45): did you mean to concatenate (`"" ~ ""`) instead ? +fail_compilation/fail_pretty_errors.d(48): did you mean to concatenate (`"" ~ ""`) instead ? +fail_compilation/fail_pretty_errors.d(51): Error: cannot implicitly convert expression `1111` of type `int` to `byte` + byte É‘ = 1111; + ^ --- */ @@ -43,4 +46,7 @@ void f() { // check supplemental error doesn't show context auto x = ""+""; + + // Check correct spacing with the presence of unicode characters and tabs + byte É‘ = 1111; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_scope.d b/gcc/testsuite/gdc.test/fail_compilation/fail_scope.d index 9851ffc..a7ac298 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail_scope.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail_scope.d @@ -3,7 +3,7 @@ TEST_OUTPUT: --- fail_compilation/fail_scope.d(43): Error: returning `cast(char[])string` escapes a reference to local variable `string` fail_compilation/fail_scope.d(61): Error: returning `s.bar()` escapes a reference to local variable `s` -fail_compilation/fail_scope.d(72): Error: `fail_scope.foo8` called with argument types `(int)` matches both: +fail_compilation/fail_scope.d(72): Error: `fail_scope.foo8` called with argument types `(int)` matches multiple overloads exactly: fail_compilation/fail_scope.d(66): `fail_scope.foo8(ref int x)` and: fail_compilation/fail_scope.d(67): `fail_scope.foo8(return ref int x)` diff --git a/gcc/testsuite/gdc.test/fail_compilation/fix22108.d b/gcc/testsuite/gdc.test/fail_compilation/fix22108.d index 149beba..8fa75cb 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fix22108.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fix22108.d @@ -1,7 +1,7 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/fix22108.d(12): Error: scope variable `p` may not be returned +fail_compilation/fix22108.d(12): Error: returning scope variable `p` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fix5212.d b/gcc/testsuite/gdc.test/fail_compilation/fix5212.d index 0b804dc..9e87e2c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fix5212.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fix5212.d @@ -1,7 +1,7 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/fix5212.d(14): Error: scope variable `args_` assigned to non-scope `this.args` +fail_compilation/fix5212.d(14): Error: assigning scope variable `args_` to non-scope `this.args` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/named_arguments_overload.d b/gcc/testsuite/gdc.test/fail_compilation/named_arguments_overload.d index a970446..7d884c4 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/named_arguments_overload.d +++ b/gcc/testsuite/gdc.test/fail_compilation/named_arguments_overload.d @@ -7,7 +7,7 @@ fail_compilation/named_arguments_overload.d(18): `named_a fail_compilation/named_arguments_overload.d(34): Error: none of the overloads of `snoopy` are callable using argument types `(immutable(T), immutable(S))` fail_compilation/named_arguments_overload.d(17): Candidates are: `named_arguments_overload.snoopy(S s, int i = 0, T t = T())` fail_compilation/named_arguments_overload.d(18): `named_arguments_overload.snoopy(T t, int i, S s)` -fail_compilation/named_arguments_overload.d(35): Error: `named_arguments_overload.snoopy` called with argument types `(immutable(S), immutable(T), immutable(int))` matches both: +fail_compilation/named_arguments_overload.d(35): Error: `named_arguments_overload.snoopy` called with argument types `(immutable(S), immutable(T), immutable(int))` matches multiple overloads after qualifier conversion: fail_compilation/named_arguments_overload.d(17): `named_arguments_overload.snoopy(S s, int i = 0, T t = T())` and: fail_compilation/named_arguments_overload.d(18): `named_arguments_overload.snoopy(T t, int i, S s)` diff --git a/gcc/testsuite/gdc.test/fail_compilation/previewin.d b/gcc/testsuite/gdc.test/fail_compilation/previewin.d index c3d11cb..77f8e43 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/previewin.d +++ b/gcc/testsuite/gdc.test/fail_compilation/previewin.d @@ -11,11 +11,11 @@ fail_compilation/previewin.d(11): `previewin.takeFunction(void function(i 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(11): `previewin.takeFunction(void function(in real) f)` declared here -fail_compilation/previewin.d(15): Error: scope variable `arg` assigned to global variable `myGlobal` -fail_compilation/previewin.d(16): Error: scope variable `arg` assigned to global variable `myGlobal` +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 fail_compilation/previewin.d(17): Error: scope parameter `arg` may not be returned -fail_compilation/previewin.d(18): Error: scope variable `arg` assigned to `ref` variable `escape` with longer lifetime -fail_compilation/previewin.d(22): Error: returning `arg` escapes a reference to parameter `arg` +fail_compilation/previewin.d(18): Error: assigning scope variable `arg` to `ref` variable `escape` with longer lifetime is not allowed in a `@safe` function +fail_compilation/previewin.d(22): Error: escaping a reference to parameter `arg` by returning `arg` is not allowed in a `@safe` function fail_compilation/previewin.d(22): perhaps annotate the parameter with `return` ---- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/pull12941.d b/gcc/testsuite/gdc.test/fail_compilation/pull12941.d index ca78050..4d14993 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/pull12941.d +++ b/gcc/testsuite/gdc.test/fail_compilation/pull12941.d @@ -1,6 +1,6 @@ /* TEST_OUTPUT: --- -fail_compilation/pull12941.d(110): Error: `pull12941.foo` called with argument types `(int*)` matches both: +fail_compilation/pull12941.d(110): Error: `pull12941.foo` called with argument types `(int*)` matches multiple overloads exactly: fail_compilation/pull12941.d(101): `pull12941.foo(return ref scope int* p)` and: fail_compilation/pull12941.d(102): `pull12941.foo(return out scope int* p)` diff --git a/gcc/testsuite/gdc.test/fail_compilation/retscope.d b/gcc/testsuite/gdc.test/fail_compilation/retscope.d index acad99b..0c2d86a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/retscope.d +++ b/gcc/testsuite/gdc.test/fail_compilation/retscope.d @@ -3,11 +3,11 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- fail_compilation/retscope.d(22): Error: scope parameter `p` may not be returned -fail_compilation/retscope.d(32): Error: returning `b ? nested1(& i) : nested2(& j)` escapes a reference to local variable `j` -fail_compilation/retscope.d(45): Error: scope variable `p` assigned to global variable `q` -fail_compilation/retscope.d(47): Error: address of variable `i` assigned to `q` with longer lifetime -fail_compilation/retscope.d(48): Error: scope variable `a` assigned to global variable `b` -fail_compilation/retscope.d(49): Error: address of expression temporary returned by `(*fp2)()` assigned to `q` with longer lifetime +fail_compilation/retscope.d(32): Error: escaping a reference to local variable `j` by returning `b ? nested1(& i) : nested2(& j)` is not allowed in a `@safe` function +fail_compilation/retscope.d(45): Error: assigning scope variable `p` to global variable `q` is not allowed in a `@safe` function +fail_compilation/retscope.d(47): Error: assigning address of variable `i` to `q` with longer lifetime is not allowed in a `@safe` function +fail_compilation/retscope.d(48): Error: assigning scope variable `a` to global variable `b` is not allowed in a `@safe` function +fail_compilation/retscope.d(49): Error: assigning address of expression temporary returned by `(*fp2)()` to `q` with longer lifetime is not allowed in a `@safe` function --- */ @@ -85,7 +85,6 @@ struct HTTP /* TEST_OUTPUT: --- -fail_compilation/retscope.d(96): Error: reference to local variable `sa` assigned to non-scope parameter `a` calling `bar8` --- */ // https://issues.dlang.org/show_bug.cgi?id=8838 @@ -107,7 +106,8 @@ int[] bar8(int[] a) @safe /* TEST_OUTPUT: --- -fail_compilation/retscope.d(123): Error: returning `foo9(cast(char[])tmp)` escapes a reference to local variable `tmp` +fail_compilation/retscope.d(95): Error: assigning reference to local variable `sa` to non-scope parameter `a` calling `bar8` is not allowed in a `@safe` function +fail_compilation/retscope.d(123): Error: escaping a reference to local variable `tmp` by returning `foo9(cast(char[])tmp)` is not allowed in a `@safe` function --- */ @@ -164,7 +164,6 @@ class C11 /* TEST_OUTPUT: --- -fail_compilation/retscope.d(177): Error: address of variable `i` assigned to `p` with longer lifetime --- */ @@ -181,7 +180,6 @@ void foo11() @safe /* TEST_OUTPUT: --- -fail_compilation/retscope.d(197): Error: scope variable `e` may not be returned --- */ @@ -201,7 +199,9 @@ void* escapeDg1(scope void* d) @safe /* TEST_OUTPUT: --- -fail_compilation/retscope.d(212): Error: scope variable `p` assigned to non-scope `e.e` +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 --- */ struct Escaper3 { void* e; } @@ -254,7 +254,6 @@ void escape4() @safe /* TEST_OUTPUT: --- -fail_compilation/retscope.d(266): Error: cannot take address of `scope` variable `p` since `scope` applies to first indirection only --- */ @@ -271,7 +270,8 @@ void escape5() @safe /* TEST_OUTPUT: --- -fail_compilation/retscope.d(286): Error: returning `foo6(& b)` escapes a reference to local variable `b` +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,7 +323,6 @@ ref int[3] asStatic2( scope int[] p) @safe { return p[0 .. 3]; } /* TEST_OUTPUT: --- -fail_compilation/retscope.d(335): Error: reference to local variable `i` assigned to non-scope `f` --- */ @@ -347,7 +346,8 @@ int* bar10( scope int** ptr ) @safe /* TEST_OUTPUT: --- -fail_compilation/retscope.d(358): Error: cannot take address of `scope` variable `aa` since `scope` applies to first indirection only +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,7 +399,6 @@ struct Foo12 /* TEST_OUTPUT: --- -fail_compilation/retscope.d(1103): Error: scope variable `f` may not be returned --- */ @@ -419,7 +418,6 @@ class Foo13 /* TEST_OUTPUT: --- -fail_compilation/retscope.d(1205): Error: scope variable `f14` calling non-scope member function `Foo14.foo()` --- */ @@ -442,7 +440,6 @@ struct Foo14 /* TEST_OUTPUT: --- -fail_compilation/retscope.d(1311): Error: scope variable `u2` assigned to `ek` with longer lifetime --- */ @@ -470,7 +467,6 @@ fail_compilation/retscope.d(1311): Error: scope variable `u2` assigned to `ek` w /* TEST_OUTPUT: --- -fail_compilation/retscope.d(1405): Error: reference to local variable `buf` assigned to non-scope anonymous parameter calling `myprintf` --- */ @@ -488,7 +484,11 @@ fail_compilation/retscope.d(1405): Error: reference to local variable `buf` assi /* TEST_OUTPUT: --- -fail_compilation/retscope.d(1509): Error: reference to stack allocated value returned by `(*fp15)()` assigned to non-scope anonymous parameter +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 --- */ @@ -678,8 +678,8 @@ int test21() /********************************************* TEST_OUTPUT: --- -fail_compilation/retscope.d(1907): Error: scope variable `x` assigned to `ref` variable `this` with longer lifetime -fail_compilation/retscope.d(1913): Error: scope variable `x` may not be returned +fail_compilation/retscope.d(1907): Error: assigning scope variable `x` to `ref` variable `this` with longer lifetime is not allowed in a `@safe` function +fail_compilation/retscope.d(1913): Error: returning scope variable `x` is not allowed in a `@safe` function --- */ #line 1900 diff --git a/gcc/testsuite/gdc.test/fail_compilation/retscope2.d b/gcc/testsuite/gdc.test/fail_compilation/retscope2.d index 2e7940f..8e10a7c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/retscope2.d +++ b/gcc/testsuite/gdc.test/fail_compilation/retscope2.d @@ -2,8 +2,6 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/retscope2.d(102): Error: scope variable `s` assigned to `ref` variable `p` with longer lifetime -fail_compilation/retscope2.d(107): Error: address of variable `s` assigned to `p` with longer lifetime --- */ @@ -36,7 +34,6 @@ void test200() /* TEST_OUTPUT: --- -fail_compilation/retscope2.d(302): Error: scope variable `a` assigned to return scope `b` --- */ @@ -52,7 +49,6 @@ fail_compilation/retscope2.d(302): Error: scope variable `a` assigned to return /* TEST_OUTPUT: --- -fail_compilation/retscope2.d(403): Error: scope variable `a` assigned to return scope `c` --- */ @@ -69,7 +65,6 @@ fail_compilation/retscope2.d(403): Error: scope variable `a` assigned to return /* TEST_OUTPUT: --- -fail_compilation/retscope2.d(504): Error: scope variable `c` may not be returned --- */ @@ -86,8 +81,13 @@ fail_compilation/retscope2.d(504): Error: scope variable `c` may not be returned /* TEST_OUTPUT: --- -fail_compilation/retscope2.d(604): Error: scope variable `__param_0` assigned to non-scope anonymous parameter calling `foo600` -fail_compilation/retscope2.d(604): Error: scope variable `__param_1` assigned to non-scope anonymous parameter calling `foo600` +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,8 +115,6 @@ 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` --- */ @@ -150,7 +148,6 @@ S700* escape700(int i) @safe /* TEST_OUTPUT: --- -fail_compilation/retscope2.d(804): Error: scope variable `e` may not be thrown --- */ @@ -167,7 +164,6 @@ void foo800() @safe /* TEST_OUTPUT: --- -fail_compilation/retscope2.d(907): Error: address of variable `this` assigned to `p17568` with longer lifetime --- */ @@ -188,9 +184,6 @@ struct T17568 /* TEST_OUTPUT: --- -fail_compilation/retscope2.d(1005): Error: scope variable `p` assigned to non-scope `this._p` -fail_compilation/retscope2.d(1021): Error: scope variable `p` assigned to non-scope `c._p` -fail_compilation/retscope2.d(1024): Error: scope variable `p` assigned to non-scope `d._p` --- */ @@ -229,7 +222,6 @@ void test17428() @safe /* TEST_OUTPUT: --- -fail_compilation/retscope2.d(1107): Error: scope variable `dg` may not be returned --- */ @@ -249,8 +241,6 @@ 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` --- */ @@ -296,7 +286,17 @@ struct T17388 /* TEST_OUTPUT: --- -fail_compilation/retscope2.d(1306): Error: copying `& i` into allocated memory escapes a reference to local variable `i` +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 --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/retscope3.d b/gcc/testsuite/gdc.test/fail_compilation/retscope3.d index 0774d0d..59bf11b 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/retscope3.d +++ b/gcc/testsuite/gdc.test/fail_compilation/retscope3.d @@ -5,8 +5,6 @@ REQUIRED_ARGS: -preview=dip1000 /* TEST_OUTPUT: --- -fail_compilation/retscope3.d(2008): Error: copying `& i` into allocated memory escapes a reference to local variable `i` -fail_compilation/retscope3.d(2017): Error: copying `S2000(& i)` into allocated memory escapes a reference to local variable `i` --- */ @@ -53,9 +51,11 @@ void bar4() /* TEST_OUTPUT: --- -fail_compilation/retscope3.d(4003): Error: copying `u[]` into allocated memory escapes a reference to parameter `u` +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: storing reference to stack allocated value returned by `makeSA()` 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 --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/retscope5.d b/gcc/testsuite/gdc.test/fail_compilation/retscope5.d index a4c8d58..fa7f23f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/retscope5.d +++ b/gcc/testsuite/gdc.test/fail_compilation/retscope5.d @@ -5,7 +5,7 @@ REQUIRED_ARGS: -preview=dip1000 /* TEST_OUTPUT: --- -fail_compilation/retscope5.d(5010): Error: address of variable `t` assigned to `p` with longer lifetime +fail_compilation/retscope5.d(5010): Error: assigning address of variable `t` to `p` with longer lifetime is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/retscope6.d b/gcc/testsuite/gdc.test/fail_compilation/retscope6.d index 3271098..49751a4 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/retscope6.d +++ b/gcc/testsuite/gdc.test/fail_compilation/retscope6.d @@ -5,7 +5,7 @@ REQUIRED_ARGS: -preview=dip1000 /* TEST_OUTPUT: --- -fail_compilation/retscope6.d(6007): Error: copying `& i` into allocated memory escapes a reference to local variable `i` +fail_compilation/retscope6.d(6007): Error: escaping a reference to local variable `i by copying `& i` into allocated memory is not allowed in a `@safe` function --- */ @@ -23,11 +23,11 @@ int* test() @safe /* TEST_OUTPUT: --- -fail_compilation/retscope6.d(7034): Error: address of variable `i` assigned to `s` with longer lifetime -fail_compilation/retscope6.d(7035): Error: address of variable `i` assigned to `s` with longer lifetime -fail_compilation/retscope6.d(7025): Error: scope variable `__param_2` assigned to `ref` variable `t` with longer lifetime +fail_compilation/retscope6.d(7034): Error: assigning address of variable `i` to `s` with longer lifetime is not allowed in a `@safe` function +fail_compilation/retscope6.d(7035): Error: assigning address of variable `i` to `s` with longer lifetime is not allowed in a `@safe` function +fail_compilation/retscope6.d(7025): Error: assigning scope variable `__param_2` to `ref` variable `t` with longer lifetime is not allowed in a `@safe` function fail_compilation/retscope6.d(7037): Error: template instance `retscope6.S.emplace4!(int*)` error instantiating -fail_compilation/retscope6.d(7037): Error: address of variable `i` assigned to `s` with longer lifetime +fail_compilation/retscope6.d(7037): Error: assigning address of variable `i` to `s` with longer lifetime is not allowed in a `@safe` function --- */ @@ -75,13 +75,13 @@ void foo() @safe /* TEST_OUTPUT: --- -fail_compilation/retscope6.d(8016): Error: address of variable `i` assigned to `p` with longer lifetime -fail_compilation/retscope6.d(8031): Error: reference to local variable `i` assigned to non-scope parameter `p` calling `betty` -fail_compilation/retscope6.d(8031): Error: reference to local variable `j` assigned to non-scope parameter `q` calling `betty` +fail_compilation/retscope6.d(8016): Error: assigning address of variable `i` to `p` with longer lifetime is not allowed in a `@safe` function +fail_compilation/retscope6.d(8031): Error: assigning reference to local variable `i` to non-scope parameter `p` calling `betty` is not allowed in a `@safe` function +fail_compilation/retscope6.d(8031): Error: assigning reference to local variable `j` to non-scope parameter `q` calling `betty` is not allowed in a `@safe` function fail_compilation/retscope6.d(8023): which is not `scope` because of `p = q` -fail_compilation/retscope6.d(8048): Error: reference to local variable `i` assigned to non-scope parameter `p` calling `archie` +fail_compilation/retscope6.d(8048): Error: assigning reference to local variable `i` to non-scope parameter `p` calling `archie` is not allowed in a `@safe` function fail_compilation/retscope6.d(8039): which is not `scope` because of `r = p` -fail_compilation/retscope6.d(8048): Error: reference to local variable `j` assigned to non-scope parameter `q` calling `archie` +fail_compilation/retscope6.d(8048): Error: assigning reference to local variable `j` to non-scope parameter `q` calling `archie` is not allowed in a `@safe` function fail_compilation/retscope6.d(8038): which is not `scope` because of `p = q` --- */ @@ -144,7 +144,7 @@ void testarchie() /* TEST_OUTPUT: --- -fail_compilation/retscope6.d(9023): Error: returning `fred(& i)` escapes a reference to local variable `i` +fail_compilation/retscope6.d(9023): Error: escaping a reference to local variable `i` by returning `fred(& i)` is not allowed in a `@safe` function --- */ @@ -177,7 +177,7 @@ T9 testfred() /* TEST_OUTPUT: --- -fail_compilation/retscope6.d(10003): Error: scope variable `values` assigned to non-scope parameter `values` calling `escape` +fail_compilation/retscope6.d(10003): Error: assigning scope variable `values` to non-scope parameter `values` calling `escape` is not allowed in a `@safe` function --- */ @@ -192,7 +192,7 @@ void escape(int[] values) {} /* TEST_OUTPUT: --- -fail_compilation/retscope6.d(11004): Error: address of variable `buffer` assigned to `secret` with longer lifetime +fail_compilation/retscope6.d(11004): Error: assigning address of variable `buffer` to `secret` with longer lifetime is not allowed in a `@safe` function --- */ @@ -207,8 +207,8 @@ void hmac(scope ubyte[] secret) /* TEST_OUTPUT: --- -fail_compilation/retscope6.d(12011): Error: returning `escape_m_20150(& x)` escapes a reference to local variable `x` -fail_compilation/retscope6.d(12022): Error: returning `escape_c_20150(& x)` escapes a reference to local variable `x` +fail_compilation/retscope6.d(12011): Error: escaping a reference to local variable `x` by returning `escape_m_20150(& x)` is not allowed in a `@safe` function +fail_compilation/retscope6.d(12022): Error: escaping a reference to local variable `x` by returning `escape_c_20150(& x)` is not allowed in a `@safe` function --- */ @@ -240,7 +240,7 @@ const(int)* f_c_20150() @safe nothrow /* TEST_OUTPUT: --- -fail_compilation/retscope6.d(13010): Error: reference to local variable `str` assigned to non-scope parameter `x` calling `f_throw` +fail_compilation/retscope6.d(13010): Error: assigning reference to local variable `str` to non-scope parameter `x` calling `f_throw` is not allowed in a `@safe` function --- */ @@ -260,9 +260,9 @@ void escape_throw_20150() @safe /* TEST_OUTPUT: --- -fail_compilation/retscope6.d(14019): Error: scope variable `scopePtr` assigned to non-scope parameter `x` calling `noInfer23021` +fail_compilation/retscope6.d(14019): Error: assigning scope variable `scopePtr` to non-scope parameter `x` calling `noInfer23021` is not allowed in a `@safe` function fail_compilation/retscope6.d(14009): which is not `scope` because of `*escapeHole = cast(const(int)*)x` -fail_compilation/retscope6.d(14022): Error: scope variable `scopePtr` may not be returned +fail_compilation/retscope6.d(14022): Error: returning scope variable `scopePtr` is not allowed in a `@safe` function --- */ @@ -299,7 +299,7 @@ ref int escape23021() @safe /* TEST_OUTPUT: --- -fail_compilation/retscope6.d(14050): Error: scope variable `z` assigned to non-scope parameter `y` calling `f23294` +fail_compilation/retscope6.d(14050): Error: assigning scope variable `z` to non-scope parameter `y` calling `f23294` is not allowed in a `@safe` function fail_compilation/retscope6.d(14044): which is not `scope` because of `x = y` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/safe_gshared.d b/gcc/testsuite/gdc.test/fail_compilation/safe_gshared.d index ea0775c..c894af8 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/safe_gshared.d +++ b/gcc/testsuite/gdc.test/fail_compilation/safe_gshared.d @@ -1,8 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/safe_gshared.d(13): Error: `@safe` function `f` cannot access `__gshared` data `x` -fail_compilation/safe_gshared.d(14): Error: `@safe` function `f` cannot access `__gshared` data `x` +fail_compilation/safe_gshared.d(13): Error: accessing `__gshared` data `x` is not allowed in a `@safe` function +fail_compilation/safe_gshared.d(14): Error: accessing `__gshared` data `x` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/safe_pointer_index.d b/gcc/testsuite/gdc.test/fail_compilation/safe_pointer_index.d index 4b107db..1bf5c5b 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/safe_pointer_index.d +++ b/gcc/testsuite/gdc.test/fail_compilation/safe_pointer_index.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/safe_pointer_index.d(11): Error: `@safe` function `f` cannot index pointer `x` +fail_compilation/safe_pointer_index.d(11): Error: indexing pointer `x` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/safer.d b/gcc/testsuite/gdc.test/fail_compilation/safer.d index a7f260a..bb81467 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/safer.d +++ b/gcc/testsuite/gdc.test/fail_compilation/safer.d @@ -1,7 +1,7 @@ /* REQUIRED_ARGS: -preview=safer TEST_OUTPUT: --- -fail_compilation/safer.d(10): Error: `void` initializers for pointers not allowed in safe functions +fail_compilation/safer.d(10): Error: `void` initializing a pointer is not allowed in a function with default safety with `-preview=safer` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/shared.d b/gcc/testsuite/gdc.test/fail_compilation/shared.d index 13b24c8..1af9594 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/shared.d +++ b/gcc/testsuite/gdc.test/fail_compilation/shared.d @@ -240,13 +240,13 @@ struct BitRange /* TEST_OUTPUT: --- -fail_compilation/shared.d(3004): Error: cast from `void*` to `shared(int*)` not allowed in safe code +fail_compilation/shared.d(3004): Error: cast from `void*` to `shared(int*)` is not allowed in a `@safe` function fail_compilation/shared.d(3004): `void` data may contain pointers and target element type is mutable -fail_compilation/shared.d(3005): Error: cast from `void*` to `shared(const(int*))` not allowed in safe code +fail_compilation/shared.d(3005): Error: cast from `void*` to `shared(const(int*))` is not allowed in a `@safe` function fail_compilation/shared.d(3005): Source type is incompatible with target type containing a pointer -fail_compilation/shared.d(3008): Error: cast from `shared(void*)` to `int*` not allowed in safe code +fail_compilation/shared.d(3008): Error: cast from `shared(void*)` to `int*` is not allowed in a `@safe` function fail_compilation/shared.d(3008): `void` data may contain pointers and target element type is mutable -fail_compilation/shared.d(3009): Error: cast from `shared(void*)` to `shared(const(int*))` not allowed in safe code +fail_compilation/shared.d(3009): Error: cast from `shared(void*)` to `shared(const(int*))` is not allowed in a `@safe` function fail_compilation/shared.d(3009): Source type is incompatible with target type containing a pointer --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/system_ptr_cast.d b/gcc/testsuite/gdc.test/fail_compilation/system_ptr_cast.d index fc10b2a..ce6541b 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/system_ptr_cast.d +++ b/gcc/testsuite/gdc.test/fail_compilation/system_ptr_cast.d @@ -2,9 +2,9 @@ REQUIRED_ARGS: -preview=dip1000 -de TEST_OUTPUT: --- -fail_compilation/system_ptr_cast.d(20): Deprecation: cast from `S*` to `int*` not allowed in safe code +fail_compilation/system_ptr_cast.d(20): Deprecation: cast from `S*` to `int*` will become `@system` in a future release fail_compilation/system_ptr_cast.d(20): Source element type has unsafe bit patterns and target element type is mutable -fail_compilation/system_ptr_cast.d(24): Deprecation: cast from `int*` to `S*` not allowed in safe code +fail_compilation/system_ptr_cast.d(24): Deprecation: cast from `int*` to `S*` will become `@system` in a future release fail_compilation/system_ptr_cast.d(24): Target element type has unsafe bit patterns --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/systemvariables.d b/gcc/testsuite/gdc.test/fail_compilation/systemvariables.d index 796eda6..098b810 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/systemvariables.d +++ b/gcc/testsuite/gdc.test/fail_compilation/systemvariables.d @@ -2,23 +2,23 @@ REQUIRED_ARGS: -preview=systemVariables TEST_OUTPUT: --- -fail_compilation/systemvariables.d(39): Error: cannot access `@system` variable `gInt` in @safe code +fail_compilation/systemvariables.d(39): Error: access `@system` variable `gInt` is not allowed in a `@safe` function fail_compilation/systemvariables.d(29): `gInt` is declared here -fail_compilation/systemvariables.d(40): Error: cannot access `@system` variable `gInt` in @safe code +fail_compilation/systemvariables.d(40): Error: access `@system` variable `gInt` is not allowed in a `@safe` function fail_compilation/systemvariables.d(29): `gInt` is declared here -fail_compilation/systemvariables.d(41): Error: cannot access `@system` variable `gArr` in @safe code +fail_compilation/systemvariables.d(41): Error: access `@system` variable `gArr` is not allowed in a `@safe` function fail_compilation/systemvariables.d(31): `gArr` is declared here -fail_compilation/systemvariables.d(42): Error: cannot access `@system` variable `gArr` in @safe code +fail_compilation/systemvariables.d(42): Error: access `@system` variable `gArr` is not allowed in a `@safe` function fail_compilation/systemvariables.d(31): `gArr` is declared here -fail_compilation/systemvariables.d(43): Error: cannot access `@system` variable `gInt` in @safe code +fail_compilation/systemvariables.d(43): Error: access `@system` variable `gInt` is not allowed in a `@safe` function fail_compilation/systemvariables.d(29): `gInt` is declared here -fail_compilation/systemvariables.d(46): Error: cannot access `@system` variable `lSys` in @safe code +fail_compilation/systemvariables.d(46): Error: access `@system` variable `lSys` is not allowed in a `@safe` function fail_compilation/systemvariables.d(45): `lSys` is declared here -fail_compilation/systemvariables.d(47): Error: cannot access `@system` variable `lSys` in @safe code +fail_compilation/systemvariables.d(47): Error: access `@system` variable `lSys` is not allowed in a `@safe` function fail_compilation/systemvariables.d(45): `lSys` is declared here -fail_compilation/systemvariables.d(48): Error: cannot access `@system` variable `lSys` in @safe code +fail_compilation/systemvariables.d(48): Error: access `@system` variable `lSys` is not allowed in a `@safe` function fail_compilation/systemvariables.d(45): `lSys` is declared here -fail_compilation/systemvariables.d(50): Error: cannot access `@system` variable `eInt` in @safe code +fail_compilation/systemvariables.d(50): Error: access `@system` variable `eInt` is not allowed in a `@safe` function fail_compilation/systemvariables.d(30): `eInt` is declared here --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/systemvariables_bool_union.d b/gcc/testsuite/gdc.test/fail_compilation/systemvariables_bool_union.d index ca6e620..2ca61e4 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/systemvariables_bool_union.d +++ b/gcc/testsuite/gdc.test/fail_compilation/systemvariables_bool_union.d @@ -2,7 +2,7 @@ REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/systemvariables_bool_union.d(21): Deprecation: cannot access overlapped field `Box.b` with unsafe bit patterns in `@safe` code +fail_compilation/systemvariables_bool_union.d(21): Deprecation: accessing overlapped field `Box.b` with unsafe bit patterns will become `@system` in a future release --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/systemvariables_deprecation.d b/gcc/testsuite/gdc.test/fail_compilation/systemvariables_deprecation.d index b511535..5ba078d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/systemvariables_deprecation.d +++ b/gcc/testsuite/gdc.test/fail_compilation/systemvariables_deprecation.d @@ -5,7 +5,7 @@ TEST_OUTPUT: fail_compilation/systemvariables_deprecation.d(16): Deprecation: `@safe` function `main` calling `middle` fail_compilation/systemvariables_deprecation.d(21): which calls `systemvariables_deprecation.inferred` fail_compilation/systemvariables_deprecation.d(27): which wouldn't be `@safe` because of: -fail_compilation/systemvariables_deprecation.d(27): cannot access `@system` variable `x0` in @safe code +fail_compilation/systemvariables_deprecation.d(27): access `@system` variable `x0` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/systemvariables_struct.d b/gcc/testsuite/gdc.test/fail_compilation/systemvariables_struct.d index 7d8bfab..2fe6816 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/systemvariables_struct.d +++ b/gcc/testsuite/gdc.test/fail_compilation/systemvariables_struct.d @@ -2,16 +2,16 @@ REQUIRED_ARGS: -preview=systemVariables TEST_OUTPUT: --- -fail_compilation/systemvariables_struct.d(31): Error: cannot access `@system` field `S.syst` in `@safe` code -fail_compilation/systemvariables_struct.d(32): Error: cannot access `@system` field `S.syst` in `@safe` code -fail_compilation/systemvariables_struct.d(33): Error: cannot access `@system` field `S.syst` in `@safe` code -fail_compilation/systemvariables_struct.d(36): Error: cannot access `@system` field `S.syst` in `@safe` code -fail_compilation/systemvariables_struct.d(37): Error: cannot access `@system` field `S.syst` in `@safe` code -fail_compilation/systemvariables_struct.d(38): Error: cannot access `@system` field `S.syst` in `@safe` code -fail_compilation/systemvariables_struct.d(54): Error: cannot access `@system` field `S2.syst` in `@safe` code -fail_compilation/systemvariables_struct.d(55): Error: cannot access `@system` field `S2.syst` in `@safe` code -fail_compilation/systemvariables_struct.d(56): Error: cannot access `@system` field `S.syst` in `@safe` code -fail_compilation/systemvariables_struct.d(57): Error: cannot access `@system` field `S.syst` in `@safe` code +fail_compilation/systemvariables_struct.d(31): Error: accessing `@system` field `S.syst` is not allowed in a `@safe` function +fail_compilation/systemvariables_struct.d(32): Error: accessing `@system` field `S.syst` is not allowed in a `@safe` function +fail_compilation/systemvariables_struct.d(33): Error: accessing `@system` field `S.syst` is not allowed in a `@safe` function +fail_compilation/systemvariables_struct.d(36): Error: accessing `@system` field `S.syst` is not allowed in a `@safe` function +fail_compilation/systemvariables_struct.d(37): Error: accessing `@system` field `S.syst` is not allowed in a `@safe` function +fail_compilation/systemvariables_struct.d(38): Error: accessing `@system` field `S.syst` is not allowed in a `@safe` function +fail_compilation/systemvariables_struct.d(54): Error: accessing `@system` field `S2.syst` is not allowed in a `@safe` function +fail_compilation/systemvariables_struct.d(55): Error: accessing `@system` field `S2.syst` is not allowed in a `@safe` function +fail_compilation/systemvariables_struct.d(56): Error: accessing `@system` field `S.syst` is not allowed in a `@safe` function +fail_compilation/systemvariables_struct.d(57): Error: accessing `@system` field `S.syst` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/systemvariables_void_init.d b/gcc/testsuite/gdc.test/fail_compilation/systemvariables_void_init.d index ea0e55d..43478e7 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/systemvariables_void_init.d +++ b/gcc/testsuite/gdc.test/fail_compilation/systemvariables_void_init.d @@ -2,13 +2,13 @@ REQUIRED_ARGS: -preview=systemVariables TEST_OUTPUT: --- -fail_compilation/systemvariables_void_init.d(48): Error: `void` initializers for types with unsafe bit patterns are not allowed in safe functions -fail_compilation/systemvariables_void_init.d(49): Error: `void` initializers for types with unsafe bit patterns are not allowed in safe functions -fail_compilation/systemvariables_void_init.d(50): Error: `void` initializers for types with unsafe bit patterns are not allowed in safe functions -fail_compilation/systemvariables_void_init.d(51): Error: a `bool` must be 0 or 1, so void intializing it is not allowed in safe functions -fail_compilation/systemvariables_void_init.d(52): Error: a `bool` must be 0 or 1, so void intializing it is not allowed in safe functions -fail_compilation/systemvariables_void_init.d(53): Error: `void` initializers for types with unsafe bit patterns are not allowed in safe functions -fail_compilation/systemvariables_void_init.d(54): Error: `void` initializers for types with unsafe bit patterns are not allowed in safe functions +fail_compilation/systemvariables_void_init.d(48): Error: `void` initializing a type with unsafe bit patterns is not allowed in a `@safe` function +fail_compilation/systemvariables_void_init.d(49): Error: `void` initializing a type with unsafe bit patterns is not allowed in a `@safe` function +fail_compilation/systemvariables_void_init.d(50): Error: `void` initializing a type with unsafe bit patterns is not allowed in a `@safe` function +fail_compilation/systemvariables_void_init.d(51): Error: void intializing a bool (which must always be 0 or 1) is not allowed in a `@safe` function +fail_compilation/systemvariables_void_init.d(52): Error: void intializing a bool (which must always be 0 or 1) is not allowed in a `@safe` function +fail_compilation/systemvariables_void_init.d(53): Error: `void` initializing a type with unsafe bit patterns is not allowed in a `@safe` function +fail_compilation/systemvariables_void_init.d(54): Error: `void` initializing a type with unsafe bit patterns is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test11006.d b/gcc/testsuite/gdc.test/fail_compilation/test11006.d index e7257b7..6bcfb92 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test11006.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test11006.d @@ -1,11 +1,13 @@ -/* REQUIRED_ARGS: -main -de - * TEST_OUTPUT: +/* TEST_OUTPUT: --- -fail_compilation/test11006.d(10): Deprecation: cannot subtract pointers to different types: `void*` and `int*`. -fail_compilation/test11006.d(10): while evaluating: `static assert(2L == 2L)` -fail_compilation/test11006.d(11): Deprecation: cannot subtract pointers to different types: `int*` and `void*`. -fail_compilation/test11006.d(11): while evaluating: `static assert(8L == 8L)` +fail_compilation/test11006.d(11): Error: cannot subtract pointers to different types: `void*` and `int*`. +fail_compilation/test11006.d(11): while evaluating: `static assert(cast(void*)8 - cast(int*)0 == 2L)` +fail_compilation/test11006.d(12): Error: cannot subtract pointers to different types: `int*` and `void*`. +fail_compilation/test11006.d(12): while evaluating: `static assert(cast(int*)8 - cast(void*)0 == 8L)` +fail_compilation/test11006.d(13): Error: cannot subtract pointers to different types: `ushort*` and `ubyte*`. +fail_compilation/test11006.d(13): while evaluating: `static assert(null - null == 0)` --- */ static assert(cast(void*)8 - cast(int*) 0 == 2L); static assert(cast(int*) 8 - cast(void*)0 == 8L); +static assert((ushort*).init - (ubyte*).init == 0); diff --git a/gcc/testsuite/gdc.test/fail_compilation/test11176.d b/gcc/testsuite/gdc.test/fail_compilation/test11176.d index 5ef7324..66a7afe 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test11176.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test11176.d @@ -1,8 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/test11176.d(12): Error: `b.ptr` cannot be used in `@safe` code, use `&b[0]` instead -fail_compilation/test11176.d(16): Error: `b.ptr` cannot be used in `@safe` code, use `&b[0]` instead +fail_compilation/test11176.d(12): Error: using `b.ptr` (instead of `&b[0])` is not allowed in a `@safe` function +fail_compilation/test11176.d(16): Error: using `b.ptr` (instead of `&b[0])` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test12822.d b/gcc/testsuite/gdc.test/fail_compilation/test12822.d index 510d9e2..bf606aa 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test12822.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test12822.d @@ -1,8 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/test12822.d(13): Error: cannot modify delegate pointer in `@safe` code `dg.ptr` -fail_compilation/test12822.d(14): Error: `dg.funcptr` cannot be used in `@safe` code +fail_compilation/test12822.d(13): Error: modifying delegate pointer `dg.ptr` is not allowed in a `@safe` function +fail_compilation/test12822.d(14): Error: using `dg.funcptr` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test13536.d b/gcc/testsuite/gdc.test/fail_compilation/test13536.d index eff807a..a602ab4 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test13536.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test13536.d @@ -1,8 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/test13536.d(22): Error: field `U.sysDg` cannot access pointers in `@safe` code that overlap other fields -fail_compilation/test13536.d(23): Error: field `U.safeDg` cannot access pointers in `@safe` code that overlap other fields +fail_compilation/test13536.d(22): Error: accessing overlapped field `U.sysDg` with pointers is not allowed in a `@safe` function +fail_compilation/test13536.d(23): Error: accessing overlapped field `U.safeDg` with pointers is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test13537.d b/gcc/testsuite/gdc.test/fail_compilation/test13537.d index 8e9811c..5421557 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test13537.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test13537.d @@ -1,10 +1,10 @@ /* TEST_OUTPUT: --- -fail_compilation/test13537.d(31): Error: field `U.y` cannot modify fields in `@safe` code that overlap fields with other storage classes -fail_compilation/test13537.d(32): Error: field `U.y` cannot modify fields in `@safe` code that overlap fields with other storage classes -fail_compilation/test13537.d(33): Error: field `U.z` cannot access pointers in `@safe` code that overlap other fields -fail_compilation/test13537.d(34): Error: field `U.y` cannot modify fields in `@safe` code that overlap fields with other storage classes +fail_compilation/test13537.d(31): Error: modifying field `U.y` which overlaps with fields with other storage classes is not allowed in a `@safe` function +fail_compilation/test13537.d(32): Error: modifying field `U.y` which overlaps with fields with other storage classes is not allowed in a `@safe` function +fail_compilation/test13537.d(33): Error: accessing overlapped field `U.z` with pointers is not allowed in a `@safe` function +fail_compilation/test13537.d(34): Error: modifying field `U.y` which overlaps with fields with other storage classes is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test14496.d b/gcc/testsuite/gdc.test/fail_compilation/test14496.d index 94d5d0f..e588629 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test14496.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test14496.d @@ -1,12 +1,12 @@ /* TEST_OUTPUT: --- -fail_compilation/test14496.d(21): Error: `void` initializers for pointers not allowed in safe functions -fail_compilation/test14496.d(24): Error: `void` initializers for pointers not allowed in safe functions -fail_compilation/test14496.d(28): Error: `void` initializers for pointers not allowed in safe functions -fail_compilation/test14496.d(48): Error: `void` initializers for pointers not allowed in safe functions -fail_compilation/test14496.d(49): Error: `void` initializers for pointers not allowed in safe functions -fail_compilation/test14496.d(50): Error: `void` initializers for pointers not allowed in safe functions +fail_compilation/test14496.d(21): Error: `void` initializing a pointer is not allowed in a `@safe` function +fail_compilation/test14496.d(24): Error: `void` initializing a pointer is not allowed in a `@safe` function +fail_compilation/test14496.d(28): Error: `void` initializing a pointer is not allowed in a `@safe` function +fail_compilation/test14496.d(48): Error: `void` initializers for pointers is not allowed in a `@safe` function +fail_compilation/test14496.d(49): Error: `void` initializers for pointers is not allowed in a `@safe` function +fail_compilation/test14496.d(50): Error: `void` initializers for pointers is not allowed in a `@safe` function --- */ // https://issues.dlang.org/show_bug.cgi?id=14496 diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15191.d b/gcc/testsuite/gdc.test/fail_compilation/test15191.d index fbbc1c0..dcd6f4d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test15191.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test15191.d @@ -4,8 +4,8 @@ REQUIRED_ARGS: -preview=dip1000 fail_compilation/test15191.d(34): Error: returning `&identity(x)` escapes a reference to local variable `x` fail_compilation/test15191.d(40): Error: returning `&identityPtr(x)` escapes a reference to local variable `x` fail_compilation/test15191.d(46): Error: returning `&identityPtr(x)` escapes a reference to local variable `x` -fail_compilation/test15191.d(67): Error: cannot take address of `scope` variable `x` since `scope` applies to first indirection only -fail_compilation/test15191.d(69): Error: cannot take address of `scope` variable `x` since `scope` applies to first indirection only +fail_compilation/test15191.d(67): Error: taking address of `scope` variable `x` with pointers is not allowed in a `@safe` function +fail_compilation/test15191.d(69): Error: taking address of `scope` variable `x` with pointers is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15399.d b/gcc/testsuite/gdc.test/fail_compilation/test15399.d index fe9934a..e017d19 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test15399.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test15399.d @@ -1,14 +1,14 @@ /* https://issues.dlang.org/show_bug.cgi?id=15399 TEST_OUTPUT: --- -fail_compilation/test15399.d(32): Error: field `S1.ptr` cannot modify misaligned pointers in `@safe` code -fail_compilation/test15399.d(33): Error: field `S2.ptr` cannot modify misaligned pointers in `@safe` code -fail_compilation/test15399.d(34): Error: field `S1.ptr` cannot modify misaligned pointers in `@safe` code -fail_compilation/test15399.d(35): Error: field `S2.ptr` cannot modify misaligned pointers in `@safe` code -fail_compilation/test15399.d(36): Error: field `S1.ptr` cannot modify misaligned pointers in `@safe` code -fail_compilation/test15399.d(37): Error: field `S2.ptr` cannot modify misaligned pointers in `@safe` code -fail_compilation/test15399.d(38): Error: field `S1.ptr` cannot modify misaligned pointers in `@safe` code -fail_compilation/test15399.d(39): Error: field `S2.ptr` cannot modify misaligned pointers in `@safe` code +fail_compilation/test15399.d(32): Error: modifying misaligned pointers through field `S1.ptr` is not allowed in a `@safe` function +fail_compilation/test15399.d(33): Error: modifying misaligned pointers through field `S2.ptr` is not allowed in a `@safe` function +fail_compilation/test15399.d(34): Error: modifying misaligned pointers through field `S1.ptr` is not allowed in a `@safe` function +fail_compilation/test15399.d(35): Error: modifying misaligned pointers through field `S2.ptr` is not allowed in a `@safe` function +fail_compilation/test15399.d(36): Error: modifying misaligned pointers through field `S1.ptr` is not allowed in a `@safe` function +fail_compilation/test15399.d(37): Error: modifying misaligned pointers through field `S2.ptr` is not allowed in a `@safe` function +fail_compilation/test15399.d(38): Error: modifying misaligned pointers through field `S1.ptr` is not allowed in a `@safe` function +fail_compilation/test15399.d(39): Error: modifying misaligned pointers through field `S2.ptr` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15544.d b/gcc/testsuite/gdc.test/fail_compilation/test15544.d index 91ac675..f1a99c6 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test15544.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test15544.d @@ -2,8 +2,8 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test15544.d(20): Error: reference to local `this` assigned to non-scope `_del` in @safe code -fail_compilation/test15544.d(22): Error: reference to local `this` assigned to non-scope `_del` in @safe code +fail_compilation/test15544.d(20): Error: assigning reference to local `this` to non-scope `_del` is not allowed in a `@safe` function +fail_compilation/test15544.d(22): Error: assigning reference to local `this` to non-scope `_del` is not allowed in a `@safe` function --- */ @@ -26,7 +26,7 @@ struct S { /* TEST_OUTPUT: --- -fail_compilation/test15544.d(46): Error: reference to local `y` assigned to non-scope `dg` in @safe code +fail_compilation/test15544.d(46): Error: assigning reference to local `y` to non-scope `dg` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15672.d b/gcc/testsuite/gdc.test/fail_compilation/test15672.d index c3d14db..22c1bee 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test15672.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test15672.d @@ -1,9 +1,9 @@ /* * TEST_OUTPUT: --- -fail_compilation/test15672.d(17): Error: cast from `void[]` to `byte[]` not allowed in safe code +fail_compilation/test15672.d(17): Error: cast from `void[]` to `byte[]` is not allowed in a `@safe` function fail_compilation/test15672.d(17): `void` data may contain pointers and target element type is mutable -fail_compilation/test15672.d(27): Error: cast from `void*` to `byte*` not allowed in safe code +fail_compilation/test15672.d(27): Error: cast from `void*` to `byte*` is not allowed in a `@safe` function fail_compilation/test15672.d(27): `void` data may contain pointers and target element type is mutable --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15703.d b/gcc/testsuite/gdc.test/fail_compilation/test15703.d index 9ee9ac5..9b241b6 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test15703.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test15703.d @@ -2,15 +2,15 @@ REQUIRED_ARGS: -m32 TEST_OUTPUT: --- -fail_compilation/test15703.d(23): Error: cast from `Object[]` to `uint[]` not allowed in safe code +fail_compilation/test15703.d(23): Error: cast from `Object[]` to `uint[]` is not allowed in a `@safe` function fail_compilation/test15703.d(23): Target element type is mutable and source element type contains a pointer -fail_compilation/test15703.d(25): Error: cast from `object.Object` to `const(uint)*` not allowed in safe code +fail_compilation/test15703.d(25): Error: cast from `object.Object` to `const(uint)*` is not allowed in a `@safe` function fail_compilation/test15703.d(25): Source type is incompatible with target type containing a pointer -fail_compilation/test15703.d(28): Error: cast from `uint[]` to `Object[]` not allowed in safe code +fail_compilation/test15703.d(28): Error: cast from `uint[]` to `Object[]` is not allowed in a `@safe` function fail_compilation/test15703.d(28): Target element type contains a pointer -fail_compilation/test15703.d(44): Error: cast from `int[]` to `S[]` not allowed in safe code +fail_compilation/test15703.d(44): Error: cast from `int[]` to `S[]` is not allowed in a `@safe` function fail_compilation/test15703.d(44): Target element type is opaque -fail_compilation/test15703.d(45): Error: cast from `S[]` to `int[]` not allowed in safe code +fail_compilation/test15703.d(45): Error: cast from `S[]` to `int[]` is not allowed in a `@safe` function fail_compilation/test15703.d(45): Source element type is opaque --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test15704.d b/gcc/testsuite/gdc.test/fail_compilation/test15704.d index 04d4be4..ce9e5bb 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test15704.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test15704.d @@ -1,9 +1,9 @@ /* * TEST_OUTPUT: --- -fail_compilation/test15704.d(17): Error: cannot copy `void[]` to `void[]` in `@safe` code -fail_compilation/test15704.d(18): Error: cannot copy `const(void)[]` to `void[]` in `@safe` code -fail_compilation/test15704.d(19): Deprecation: cannot copy `int[]` to `void[]` in `@safe` code +fail_compilation/test15704.d(17): Error: copying `void[]` to `void[]` is not allowed in a `@safe` function +fail_compilation/test15704.d(18): Error: copying `const(void)[]` to `void[]` is not allowed in a `@safe` function +fail_compilation/test15704.d(19): Deprecation: copying `int[]` to `void[]` will become `@system` in a future release --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16365.d b/gcc/testsuite/gdc.test/fail_compilation/test16365.d index 5bfa5f8..fd16247 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test16365.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test16365.d @@ -1,9 +1,9 @@ /* TEST_OUTPUT: --- -fail_compilation/test16365.d(20): Error: `this` reference necessary to take address of member `f1` in `@safe` function `main` +fail_compilation/test16365.d(20): Error: taking address of member `f1` without `this` reference is not allowed in a `@safe` function fail_compilation/test16365.d(22): Error: cannot implicitly convert expression `&f2` of type `void delegate() pure nothrow @nogc @safe` to `void function() @safe` -fail_compilation/test16365.d(27): Error: `dg.funcptr` cannot be used in `@safe` code +fail_compilation/test16365.d(27): Error: using `dg.funcptr` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test16589.d b/gcc/testsuite/gdc.test/fail_compilation/test16589.d index dc4c593..229028d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test16589.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test16589.d @@ -2,13 +2,13 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test16589.d(26): Error: returning `&this.data` escapes a reference to parameter `this` +fail_compilation/test16589.d(26): Error: escaping a reference to parameter `this` by returning `&this.data` is not allowed in a `@safe` function fail_compilation/test16589.d(24): perhaps annotate the function with `return` -fail_compilation/test16589.d(31): Error: returning `&this` escapes a reference to parameter `this` +fail_compilation/test16589.d(31): Error: escaping a reference to parameter `this` by returning `&this` is not allowed in a `@safe` function fail_compilation/test16589.d(29): perhaps annotate the function with `return` -fail_compilation/test16589.d(37): Error: returning `&s.data` escapes a reference to parameter `s` +fail_compilation/test16589.d(37): Error: escaping a reference to parameter `s` by returning `&s.data` is not allowed in a `@safe` function fail_compilation/test16589.d(35): perhaps annotate the parameter with `return` -fail_compilation/test16589.d(42): Error: returning `&s` escapes a reference to parameter `s` +fail_compilation/test16589.d(42): Error: escaping a reference to parameter `s` by returning `&s` is not allowed in a `@safe` function fail_compilation/test16589.d(40): perhaps annotate the parameter with `return` fail_compilation/test16589.d(47): Error: returning `&s.data` escapes a reference to parameter `s` fail_compilation/test16589.d(52): Error: returning `& s` escapes a reference to parameter `s` diff --git a/gcc/testsuite/gdc.test/fail_compilation/test17284.d b/gcc/testsuite/gdc.test/fail_compilation/test17284.d index b7fd979..a68a0b3 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test17284.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test17284.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/test17284.d(17): Error: field `U.c` cannot access pointers in `@safe` code that overlap other fields +fail_compilation/test17284.d(17): Error: accessing overlapped field `U.c` with pointers is not allowed in a `@safe` function pure nothrow @safe void(U t) --- REQUIRED_ARGS: -preview=bitfields diff --git a/gcc/testsuite/gdc.test/fail_compilation/test17422.d b/gcc/testsuite/gdc.test/fail_compilation/test17422.d index 80f8fbe..e5577dd 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test17422.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test17422.d @@ -2,7 +2,7 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test17422.d(23): Error: scope variable `p` may not be returned +fail_compilation/test17422.d(23): Error: returning scope variable `p` is not allowed in a `@safe` function --- */ struct RC diff --git a/gcc/testsuite/gdc.test/fail_compilation/test17423.d b/gcc/testsuite/gdc.test/fail_compilation/test17423.d index faa9806..785bbe7 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test17423.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test17423.d @@ -1,7 +1,7 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test17423.d(27): Error: reference to local `this` assigned to non-scope parameter `dlg` calling `opApply` +fail_compilation/test17423.d(27): Error: assigning reference to local `this` to non-scope parameter `dlg` calling `opApply` is not allowed in a `@safe` function fail_compilation/test17423.d(16): which is not `scope` because of `this.myDlg = dlg` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test17450.d b/gcc/testsuite/gdc.test/fail_compilation/test17450.d index ddf3f46..6258dbe 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test17450.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test17450.d @@ -2,9 +2,9 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test17450.d(17): Error: returning `&s.bar` escapes a reference to parameter `s` +fail_compilation/test17450.d(17): Error: escaping a reference to parameter `s` by returning `&s.bar` is not allowed in a `@safe` function fail_compilation/test17450.d(16): perhaps annotate the parameter with `return` -fail_compilation/test17450.d(20): Error: returning `&this.bar` escapes a reference to parameter `this` +fail_compilation/test17450.d(20): Error: escaping a reference to parameter `this` by returning `&this.bar` is not allowed in a `@safe` function fail_compilation/test17450.d(19): perhaps annotate the function with `return` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test17764.d b/gcc/testsuite/gdc.test/fail_compilation/test17764.d index befcdb1..2f12348 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test17764.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test17764.d @@ -1,7 +1,7 @@ /* REQUIRED_ARGS: -preview=dip1000 * TEST_OUTPUT: --- -fail_compilation/test17764.d(109): Error: scope variable `c` assigned to global variable `global` +fail_compilation/test17764.d(109): Error: assigning scope variable `c` to global variable `global` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test17959.d b/gcc/testsuite/gdc.test/fail_compilation/test17959.d index cd2216f..201511d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test17959.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test17959.d @@ -1,8 +1,8 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test17959.d(18): Error: scope variable `this` assigned to non-scope `this.escape` -fail_compilation/test17959.d(19): Error: scope variable `this` assigned to non-scope `this.f` +fail_compilation/test17959.d(18): Error: assigning scope variable `this` to non-scope `this.escape` is not allowed in a `@safe` function +fail_compilation/test17959.d(19): Error: assigning scope variable `this` to non-scope `this.f` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test17977.d b/gcc/testsuite/gdc.test/fail_compilation/test17977.d index ff6bc1c..b79d36c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test17977.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test17977.d @@ -3,7 +3,7 @@ https://issues.dlang.org/show_bug.cgi?id=15399 REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test17977.d(19): Error: address of variable `__slList3` assigned to `elem` with longer lifetime +fail_compilation/test17977.d(19): Error: assigning address of variable `__slList3` to `elem` with longer lifetime is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test18282.d b/gcc/testsuite/gdc.test/fail_compilation/test18282.d index 580fe1b..97b2b2b 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test18282.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test18282.d @@ -1,13 +1,13 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test18282.d(25): Error: scope variable `aa` may not be returned -fail_compilation/test18282.d(34): Error: copying `& i` into allocated memory escapes a reference to local variable `i` -fail_compilation/test18282.d(35): Error: copying `& i` into allocated memory escapes a reference to local variable `i` -fail_compilation/test18282.d(36): Error: scope variable `staa` may not be returned -fail_compilation/test18282.d(44): Error: copying `S2000(& i)` into allocated memory escapes a reference to local variable `i` -fail_compilation/test18282.d(53): Error: copying `& i` into allocated memory escapes a reference to local variable `i` -fail_compilation/test18282.d(53): Error: copying `& c` into allocated memory escapes a reference to local variable `c` +fail_compilation/test18282.d(25): Error: returning scope variable `aa` is not allowed in a `@safe` function +fail_compilation/test18282.d(34): Error: escaping a reference to local variable `i by copying `& i` into allocated memory is not allowed in a `@safe` function +fail_compilation/test18282.d(35): Error: escaping a reference to local variable `i by copying `& i` into allocated memory is not allowed in a `@safe` function +fail_compilation/test18282.d(36): Error: returning scope variable `staa` is not allowed in a `@safe` function +fail_compilation/test18282.d(44): Error: escaping a reference to local variable `i by copying `S2000(& i)` into allocated memory is not allowed in a `@safe` function +fail_compilation/test18282.d(53): Error: escaping a reference to local variable `i by copying `& i` into allocated memory is not allowed in a `@safe` function +fail_compilation/test18282.d(53): Error: escaping a reference to local variable `c by copying `& c` into allocated memory is not allowed in a `@safe` function --- */ @@ -57,10 +57,10 @@ void bar3() /****************************** TEST_OUTPUT: --- -fail_compilation/test18282.d(1007): Error: copying `& foo` into allocated memory escapes a reference to local variable `foo` -fail_compilation/test18282.d(1008): Error: copying `& foo` into allocated memory escapes a reference to local variable `foo` -fail_compilation/test18282.d(1009): Error: copying `& foo` into allocated memory escapes a reference to local variable `foo` -fail_compilation/test18282.d(1016): Error: copying `&this` into allocated memory escapes a reference to parameter `this` +fail_compilation/test18282.d(1007): Error: escaping a reference to local variable `foo by copying `& foo` into allocated memory is not allowed in a `@safe` function +fail_compilation/test18282.d(1008): Error: escaping a reference to local variable `foo by copying `& foo` into allocated memory is not allowed in a `@safe` function +fail_compilation/test18282.d(1009): Error: escaping a reference to local variable `foo by copying `& foo` into allocated memory is not allowed in a `@safe` function +fail_compilation/test18282.d(1016): Error: escaping a reference to parameter `this` by copying `&this` into allocated memory is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test18385b.d b/gcc/testsuite/gdc.test/fail_compilation/test18385b.d index f0b9d01..8442226 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test18385b.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test18385b.d @@ -4,11 +4,11 @@ because they ignored the actual function name TEST_OUTPUT: --- -fail_compilation/test18385b.d(13): Error: `test18385b.S.foo` called with argument types `(int)` matches both: +fail_compilation/test18385b.d(13): Error: `test18385b.S.foo` called with argument types `(int)` matches multiple overloads exactly: fail_compilation/test18385b.d(8): `test18385b.S.foo(int s)` and: fail_compilation/test18385b.d(3): `test18385b.foo(int s)` -fail_compilation/test18385b.d(102): Error: `test18385b.bar` called with argument types `(int)` matches both: +fail_compilation/test18385b.d(102): Error: `test18385b.bar` called with argument types `(int)` matches multiple overloads exactly: fail_compilation/test18385b.d(2): `test18385b.bar(int s)` and: fail_compilation/test18385b.d(3): `test18385b.foo(int s)` diff --git a/gcc/testsuite/gdc.test/fail_compilation/test18597.d b/gcc/testsuite/gdc.test/fail_compilation/test18597.d index 66cde58..38c1f02 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test18597.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test18597.d @@ -1,8 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/test18597.d(24): Error: field `Unaligned.p` cannot modify misaligned pointers in `@safe` code -fail_compilation/test18597.d(25): Error: field `Unaligned.p` cannot assign to misaligned pointers in `@safe` code -fail_compilation/test18597.d(26): Error: field `Unaligned.p` cannot assign to misaligned pointers in `@safe` code +fail_compilation/test18597.d(24): Error: modifying misaligned pointers through field `Unaligned.p` is not allowed in a `@safe` function +fail_compilation/test18597.d(25): Error: field `Unaligned.p` assigning to misaligned pointers is not allowed in a `@safe` function +fail_compilation/test18597.d(26): Error: field `Unaligned.p` assigning to misaligned pointers is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test18644.d b/gcc/testsuite/gdc.test/fail_compilation/test18644.d index 201e446..da7c536 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test18644.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test18644.d @@ -1,9 +1,9 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test18644.d(15): Error: nested function `foo` returns `scope` values and escapes them into allocated memory -fail_compilation/test18644.d(16): Error: escaping local variable through nested function `foo` -fail_compilation/test18644.d(22): Error: escaping local variable through nested function `foo` +fail_compilation/test18644.d(15): Error: escaping a `scope` value returned from nested function `foo` into allocated memory is not allowed in a `@safe` function +fail_compilation/test18644.d(16): Error: escaping local variable through nested function `foo` is not allowed in a `@safe` function +fail_compilation/test18644.d(22): Error: escaping local variable through nested function `foo` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test19097.d b/gcc/testsuite/gdc.test/fail_compilation/test19097.d index 980931e..f415dd9 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test19097.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test19097.d @@ -1,14 +1,14 @@ /* REQUIRED_ARGS: -preview=dip1000 * TEST_OUTPUT: --- -fail_compilation/test19097.d(44): Error: scope variable `s` may not be returned -fail_compilation/test19097.d(48): Error: scope variable `s1` may not be returned -fail_compilation/test19097.d(77): Error: scope variable `z` assigned to `ref` variable `refPtr` with longer lifetime -fail_compilation/test19097.d(108): Error: scope variable `s4` may not be returned -fail_compilation/test19097.d(126): Error: scope variable `s5c` may not be returned -fail_compilation/test19097.d(130): Error: scope variable `s5m` may not be returned -fail_compilation/test19097.d(147): Error: scope variable `s6c` may not be returned -fail_compilation/test19097.d(151): Error: scope variable `s6m` may not be returned +fail_compilation/test19097.d(44): Error: returning scope variable `s` is not allowed in a `@safe` function +fail_compilation/test19097.d(48): Error: returning scope variable `s1` is not allowed in a `@safe` function +fail_compilation/test19097.d(77): Error: assigning scope variable `z` to `ref` variable `refPtr` with longer lifetime is not allowed in a `@safe` function +fail_compilation/test19097.d(108): Error: returning scope variable `s4` is not allowed in a `@safe` function +fail_compilation/test19097.d(126): Error: returning scope variable `s5c` is not allowed in a `@safe` function +fail_compilation/test19097.d(130): Error: returning scope variable `s5m` is not allowed in a `@safe` function +fail_compilation/test19097.d(147): Error: returning scope variable `s6c` is not allowed in a `@safe` function +fail_compilation/test19097.d(151): Error: returning scope variable `s6m` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test19646.d b/gcc/testsuite/gdc.test/fail_compilation/test19646.d index 766b387..c564ffe 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test19646.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test19646.d @@ -1,6 +1,6 @@ /* TEST_OUTPUT: --- -fail_compilation/test19646.d(12): Error: cast from `const(int)*` to `int*` not allowed in safe code +fail_compilation/test19646.d(12): Error: cast from `const(int)*` to `int*` can't initialize `@safe` variable `y` fail_compilation/test19646.d(12): Source type is incompatible with target type containing a pointer fail_compilation/test19646.d(18): Error: `@safe` variable `z` cannot be initialized by calling `@system` function `f` --- diff --git a/gcc/testsuite/gdc.test/fail_compilation/test20023.d b/gcc/testsuite/gdc.test/fail_compilation/test20023.d index 909e699..ab908e8 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test20023.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test20023.d @@ -3,7 +3,7 @@ /* TEST_OUTPUT: --- -fail_compilation/imports/test20023b.d(8): Error: scope variable `e` may not be returned +fail_compilation/imports/test20023b.d(8): Error: returning scope variable `e` is not allowed in a `@safe` function fail_compilation/test20023.d(15): Error: template instance `imports.test20023b.threw!()` error instantiating --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test20245.d b/gcc/testsuite/gdc.test/fail_compilation/test20245.d index a6bbba2..5484786 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test20245.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test20245.d @@ -2,15 +2,15 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test20245.d(21): Error: reference to local variable `x` assigned to non-scope parameter `ptr` calling `escape` -fail_compilation/test20245.d(22): Error: copying `&x` into allocated memory escapes a reference to parameter `x` -fail_compilation/test20245.d(23): Error: scope variable `a` may not be returned -fail_compilation/test20245.d(27): Error: cannot take address of `scope` variable `x` since `scope` applies to first indirection only -fail_compilation/test20245.d(33): Error: reference to local variable `x` assigned to non-scope parameter `ptr` calling `escape` -fail_compilation/test20245.d(34): Error: copying `&x` into allocated memory escapes a reference to parameter `x` -fail_compilation/test20245.d(50): Error: reference to local variable `price` assigned to non-scope `this.minPrice` -fail_compilation/test20245.d(69): Error: reference to local variable `this.content[]` calling non-scope member function `Exception.this()` -fail_compilation/test20245.d(89): Error: reference to local variable `this` assigned to non-scope parameter `content` calling `listUp` +fail_compilation/test20245.d(21): Error: assigning reference to local variable `x` to non-scope parameter `ptr` calling `escape` is not allowed in a `@safe` function +fail_compilation/test20245.d(22): Error: escaping a reference to parameter `x` by copying `&x` into allocated memory is not allowed in a `@safe` function +fail_compilation/test20245.d(23): Error: returning scope variable `a` is not allowed in a `@safe` function +fail_compilation/test20245.d(27): Error: taking address of `scope` variable `x` with pointers is not allowed in a `@safe` function +fail_compilation/test20245.d(33): Error: assigning reference to local variable `x` to non-scope parameter `ptr` calling `escape` is not allowed in a `@safe` function +fail_compilation/test20245.d(34): Error: escaping a reference to parameter `x` by copying `&x` into allocated memory is not allowed in a `@safe` function +fail_compilation/test20245.d(50): Error: assigning reference to local variable `price` to non-scope `this.minPrice` is not allowed in a `@safe` function +fail_compilation/test20245.d(69): Error: reference to local variable `this.content[]` calling non-scope member function `Exception.this()` is not allowed in a `@safe` function +fail_compilation/test20245.d(89): Error: assigning reference to local variable `this` to non-scope parameter `content` calling `listUp` is not allowed in a `@safe` function fail_compilation/test20245.d(82): which is not `scope` because of `charPtr = content` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test20569.d b/gcc/testsuite/gdc.test/fail_compilation/test20569.d index 7ad50dc..85a88c8 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test20569.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test20569.d @@ -1,8 +1,8 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test20569.d(19): Error: cannot take address of `scope` variable `s1` since `scope` applies to first indirection only -fail_compilation/test20569.d(23): Error: cannot take address of `scope` variable `s2` since `scope` applies to first indirection only +fail_compilation/test20569.d(19): Error: taking address of `scope` variable `s1` with pointers is not allowed in a `@safe` function +fail_compilation/test20569.d(23): Error: taking address of `scope` variable `s2` with pointers is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test20655.d b/gcc/testsuite/gdc.test/fail_compilation/test20655.d index c3bb70a..48a6fe2 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test20655.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test20655.d @@ -4,13 +4,13 @@ TEST_OUTPUT: --- fail_compilation/test20655.d(29): Deprecation: `@safe` function `g` calling `f1` fail_compilation/test20655.d(24): which wouldn't be `@safe` because of: -fail_compilation/test20655.d(24): field `U.s` cannot access pointers in `@safe` code that overlap other fields +fail_compilation/test20655.d(24): accessing overlapped field `U.s` with pointers fail_compilation/test20655.d(30): Deprecation: `@safe` function `g` calling `f2` fail_compilation/test20655.d(25): which wouldn't be `@safe` because of: -fail_compilation/test20655.d(25): field `U.s` cannot access pointers in `@safe` code that overlap other fields +fail_compilation/test20655.d(25): accessing overlapped field `U.s` with pointers fail_compilation/test20655.d(31): Deprecation: `@safe` function `g` calling `f3` fail_compilation/test20655.d(28): which wouldn't be `@safe` because of: -fail_compilation/test20655.d(28): field `U.s` cannot access pointers in `@safe` code that overlap other fields +fail_compilation/test20655.d(28): accessing overlapped field `U.s` with pointers --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test20809.d b/gcc/testsuite/gdc.test/fail_compilation/test20809.d index 0b45277..ea95d6c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test20809.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test20809.d @@ -2,7 +2,7 @@ REQUIRED_ARGS: TEST_OUTPUT: --- -fail_compilation/test20809.d(114): Error: returning `this.a` escapes a reference to parameter `this` +fail_compilation/test20809.d(114): Error: escaping a reference to parameter `this` by returning `this.a` is not allowed in a `@safe` function fail_compilation/test20809.d(112): perhaps annotate the function with `return` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test20881.d b/gcc/testsuite/gdc.test/fail_compilation/test20881.d index d4c5f07..add4d73 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test20881.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test20881.d @@ -2,10 +2,10 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test20881.d(20): Error: scope variable `this` may not be returned -fail_compilation/test20881.d(27): Error: address of variable `s` assigned to `global` with longer lifetime -fail_compilation/test20881.d(28): Error: address of variable `s` assigned to `global` with longer lifetime -fail_compilation/test20881.d(29): Error: address of variable `s` assigned to `global` with longer lifetime +fail_compilation/test20881.d(20): Error: returning scope variable `this` is not allowed in a `@safe` function +fail_compilation/test20881.d(27): Error: assigning address of variable `s` to `global` with longer lifetime is not allowed in a `@safe` function +fail_compilation/test20881.d(28): Error: assigning address of variable `s` to `global` with longer lifetime is not allowed in a `@safe` function +fail_compilation/test20881.d(29): Error: assigning address of variable `s` to `global` with longer lifetime is not allowed in a `@safe` function --- */ @safe: diff --git a/gcc/testsuite/gdc.test/fail_compilation/test20998.d b/gcc/testsuite/gdc.test/fail_compilation/test20998.d index 2e137ab..00ff25f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test20998.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test20998.d @@ -30,7 +30,7 @@ X3 x3 = { ptr: null, "a", ptr: 2, 444 }; fail_compilation/test20998.d(90): Error: too many initializers for `X3` with 3 fields X3 x3 = { ptr: null, "a", ptr: 2, 444 }; ^ -fail_compilation/test20998.d(98): Error: field `X4.ptr` cannot assign to misaligned pointers in `@safe` code +fail_compilation/test20998.d(98): Error: field `X4.ptr` assigning to misaligned pointers is not allowed in a `@safe` function X4 x4 = { ptr: null, "a", 444, ptr: 2, true }; ^ fail_compilation/test20998.d(98): Error: cannot implicitly convert expression `"a"` of type `string` to `int` diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21665.d b/gcc/testsuite/gdc.test/fail_compilation/test21665.d index b4c2811..eb99509 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test21665.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test21665.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/test21665.d(18): Error: `void` initializers for structs with invariants are not allowed in safe functions -fail_compilation/test21665.d(30): Error: field `U.s` cannot access structs with invariants in `@safe` code that overlap other fields +fail_compilation/test21665.d(18): Error: `void` initializing a struct with an invariant is not allowed in a `@safe` function +fail_compilation/test21665.d(30): Error: accessing overlapped field `U.s` with a structs invariant is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test22145.d b/gcc/testsuite/gdc.test/fail_compilation/test22145.d index 55e7c63..ffba4d5 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test22145.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test22145.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: REQUIRED_ARGS: -preview=dip1000 --- -fail_compilation/test22145.d(115): Error: scope variable `x` assigned to global variable `global` +fail_compilation/test22145.d(115): Error: assigning scope variable `x` to global variable `global` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test22227.d b/gcc/testsuite/gdc.test/fail_compilation/test22227.d index ecffb69..32cac84 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test22227.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test22227.d @@ -1,8 +1,8 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test22227.d(12): Error: scope variable `foo` may not be returned -fail_compilation/test22227.d(14): Error: scope variable `foo` may not be returned +fail_compilation/test22227.d(12): Error: returning scope variable `foo` is not allowed in a `@safe` function +fail_compilation/test22227.d(14): Error: returning scope variable `foo` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test22298.d b/gcc/testsuite/gdc.test/fail_compilation/test22298.d index cdb1a3e..339727e 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test22298.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test22298.d @@ -2,8 +2,8 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test22298.d(18): Error: scope variable `i` assigned to `p` with longer lifetime -fail_compilation/test22298.d(29): Error: scope variable `y` assigned to `x` with longer lifetime +fail_compilation/test22298.d(18): Error: assigning scope variable `i` to `p` with longer lifetime is not allowed in a `@safe` function +fail_compilation/test22298.d(29): Error: assigning scope variable `y` to `x` with longer lifetime is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test22541.d b/gcc/testsuite/gdc.test/fail_compilation/test22541.d index 6152f44..4be0018 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test22541.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test22541.d @@ -1,7 +1,7 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test22541.d(104): Error: returning `i` escapes a reference to parameter `i` +fail_compilation/test22541.d(104): Error: escaping a reference to parameter `i` by returning `i` is not allowed in a `@safe` function fail_compilation/test22541.d(102): perhaps annotate the parameter with `return` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test22680.d b/gcc/testsuite/gdc.test/fail_compilation/test22680.d index 85e653e..0c86ec8 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test22680.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test22680.d @@ -1,7 +1,7 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test22680.d(104): Error: scope variable `this` assigned to global variable `c` +fail_compilation/test22680.d(104): Error: assigning scope variable `this` to global variable `c` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test22709.d b/gcc/testsuite/gdc.test/fail_compilation/test22709.d index dd5258e..17932ac 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test22709.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test22709.d @@ -2,8 +2,8 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test22709.d(15): Error: address of variable `local` assigned to `arr` with longer lifetime -fail_compilation/test22709.d(20): Error: address of variable `local` assigned to `arr` with longer lifetime +fail_compilation/test22709.d(15): Error: assigning address of variable `local` to `arr` with longer lifetime is not allowed in a `@safe` function +fail_compilation/test22709.d(20): Error: assigning address of variable `local` to `arr` with longer lifetime is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test22910.d b/gcc/testsuite/gdc.test/fail_compilation/test22910.d index 581c693..b4089b5 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test22910.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test22910.d @@ -1,7 +1,7 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test22910.d(17): Error: returning `&this.val` escapes a reference to parameter `this` +fail_compilation/test22910.d(17): Error: escaping a reference to parameter `this` by returning `&this.val` is not allowed in a `@safe` function fail_compilation/test22910.d(15): perhaps change the `return scope` into `scope return` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test22977.d b/gcc/testsuite/gdc.test/fail_compilation/test22977.d index 9478ec9..569b722 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test22977.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test22977.d @@ -2,8 +2,8 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test22977.d(16): Error: escaping local variable through nested function `scfunc` -fail_compilation/test22977.d(22): Error: escaping local variable through nested function `scfunc2` +fail_compilation/test22977.d(16): Error: escaping local variable through nested function `scfunc` is not allowed in a `@safe` function +fail_compilation/test22977.d(22): Error: escaping local variable through nested function `scfunc2` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test23073.d b/gcc/testsuite/gdc.test/fail_compilation/test23073.d index 39106ba..e47569a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test23073.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test23073.d @@ -2,7 +2,7 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test23073.d(28): Error: scope variable `c` assigned to non-scope parameter `c` calling `assignNext` +fail_compilation/test23073.d(28): Error: assigning scope variable `c` to non-scope parameter `c` calling `assignNext` is not allowed in a `@safe` function fail_compilation/test23073.d(22): which is not `scope` because of `c.next = c` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test23491.d b/gcc/testsuite/gdc.test/fail_compilation/test23491.d index b66d8a8..124297f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test23491.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test23491.d @@ -2,9 +2,9 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test23491.d(16): Error: reference to local variable `buffer` assigned to non-scope anonymous parameter -fail_compilation/test23491.d(17): Error: reference to local variable `buffer` assigned to non-scope anonymous parameter calling `sinkF` -fail_compilation/test23491.d(18): Error: reference to local variable `buffer` assigned to non-scope parameter `buf` +fail_compilation/test23491.d(16): Error: reference to local variable `buffer` assigned to non-scope anonymous parameter is not allowed in a `@safe` function +fail_compilation/test23491.d(17): Error: assigning reference to local variable `buffer` to non-scope anonymous parameter calling `sinkF` is not allowed in a `@safe` function +fail_compilation/test23491.d(18): Error: assigning reference to local variable `buffer` to non-scope parameter `buf` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test23982.d b/gcc/testsuite/gdc.test/fail_compilation/test23982.d index f8eee23..dac70fd 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test23982.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test23982.d @@ -2,7 +2,7 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test23982.d(35): Error: scope variable `a` assigned to non-scope parameter `a` calling `foo2` +fail_compilation/test23982.d(35): Error: assigning scope variable `a` to non-scope parameter `a` calling `foo2` is not allowed in a `@safe` function fail_compilation/test23982.d(26): which is not `scope` because of `b = a` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test24015.d b/gcc/testsuite/gdc.test/fail_compilation/test24015.d index c9bc42e..837619d 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test24015.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test24015.d @@ -1,7 +1,7 @@ /* REQUIRED_ARGS: -preview=dip1000 * TEST_OUTPUT: --- -fail_compilation/test24015.d(19): Error: scope variable `v` assigned to non-scope parameter `...` calling `jer` +fail_compilation/test24015.d(19): Error: assigning scope variable `v` to non-scope parameter `...` calling `jer` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test24680.d b/gcc/testsuite/gdc.test/fail_compilation/test24680.d index 50efba4..3833e0e 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test24680.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test24680.d @@ -2,7 +2,7 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test24680.d(19): Error: returning `c.peek(buf[])` escapes a reference to local variable `buf` +fail_compilation/test24680.d(19): Error: escaping a reference to local variable `buf` by returning `c.peek(buf[])` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test24694.d b/gcc/testsuite/gdc.test/fail_compilation/test24694.d index cec9635..7b58fbbf 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test24694.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test24694.d @@ -2,7 +2,7 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test24694.d(25): Error: reference to local variable `x` assigned to non-scope `b.c.p` +fail_compilation/test24694.d(25): Error: assigning reference to local variable `x` to non-scope `b.c.p` is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/testInference.d b/gcc/testsuite/gdc.test/fail_compilation/testInference.d index b3a8a56..a04feae 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/testInference.d +++ b/gcc/testsuite/gdc.test/fail_compilation/testInference.d @@ -222,7 +222,7 @@ void test13729b() pure /* TEST_OUTPUT: --- -fail_compilation/testInference.d(225): Error: `testInference.test17086` called with argument types `(bool)` matches both: +fail_compilation/testInference.d(225): Error: `testInference.test17086` called with argument types `(bool)` matches multiple overloads exactly: fail_compilation/testInference.d(219): `testInference.test17086!(bool, false).test17086(bool x)` and: fail_compilation/testInference.d(220): `testInference.test17086!(bool, false).test17086(bool y)` diff --git a/gcc/testsuite/gdc.test/fail_compilation/testOpApply.d b/gcc/testsuite/gdc.test/fail_compilation/testOpApply.d index 8d6c736..8aea55f 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/testOpApply.d +++ b/gcc/testsuite/gdc.test/fail_compilation/testOpApply.d @@ -1,7 +1,7 @@ /+ TEST_OUTPUT: --- -fail_compilation/testOpApply.d(27): Error: `testOpApply.SameAttr.opApply` called with argument types `(int delegate(int i) pure nothrow @nogc @safe)` matches both: +fail_compilation/testOpApply.d(27): Error: `testOpApply.SameAttr.opApply` called with argument types `(int delegate(int i) pure nothrow @nogc @safe)` matches multiple overloads after qualifier conversion: fail_compilation/testOpApply.d(13): `testOpApply.SameAttr.opApply(int delegate(int) @system dg)` and: fail_compilation/testOpApply.d(18): `testOpApply.SameAttr.opApply(int delegate(int) @system dg)` @@ -30,7 +30,7 @@ void testSameAttr() @safe /+ TEST_OUTPUT: --- -fail_compilation/testOpApply.d(104): Error: `testOpApply.SameAttr.opApply` called with argument types `(int delegate(int i) pure nothrow @nogc @system)` matches both: +fail_compilation/testOpApply.d(104): Error: `testOpApply.SameAttr.opApply` called with argument types `(int delegate(int i) pure nothrow @nogc @system)` matches multiple overloads after qualifier conversion: fail_compilation/testOpApply.d(13): `testOpApply.SameAttr.opApply(int delegate(int) @system dg)` and: fail_compilation/testOpApply.d(18): `testOpApply.SameAttr.opApply(int delegate(int) @system dg)` diff --git a/gcc/testsuite/gdc.test/fail_compilation/union_initialization.d b/gcc/testsuite/gdc.test/fail_compilation/union_initialization.d index 36fc63a..5c2a1d4 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/union_initialization.d +++ b/gcc/testsuite/gdc.test/fail_compilation/union_initialization.d @@ -3,8 +3,8 @@ https://issues.dlang.org/show_bug.cgi?id=20068 TEST_OUTPUT: --- -fail_compilation/union_initialization.d(19): Error: field `B.p` cannot access pointers in `@safe` code that overlap other fields -fail_compilation/union_initialization.d(25): Error: field `B.p` cannot access pointers in `@safe` code that overlap other fields +fail_compilation/union_initialization.d(19): Error: accessing overlapped field `B.p` with pointers is not allowed in a `@safe` function +fail_compilation/union_initialization.d(25): Error: accessing overlapped field `B.p` with pointers is not allowed in a `@safe` function --- */ diff --git a/gcc/testsuite/gdc.test/runnable/future.d b/gcc/testsuite/gdc.test/runnable/future.d index e0ef466..9d09f6b 100644 --- a/gcc/testsuite/gdc.test/runnable/future.d +++ b/gcc/testsuite/gdc.test/runnable/future.d @@ -1,8 +1,9 @@ /* PERMUTE_ARGS: +REQUIRED_ARGS: -verrors=simple TEST_OUTPUT: --- -runnable/future.d(16): Deprecation: method `future.B.msg` implicitly overrides `@__future` base class method; rename the former -runnable/future.d(11): base method `future.A.msg` defined here +runnable/future.d(17): Deprecation: method `future.B.msg` implicitly overrides `@__future` base class method; rename the former +runnable/future.d(12): base method `future.A.msg` defined here --- */ diff --git a/gcc/testsuite/gdc.test/runnable/implicit.d b/gcc/testsuite/gdc.test/runnable/implicit.d index 75b992c..802e382 100644 --- a/gcc/testsuite/gdc.test/runnable/implicit.d +++ b/gcc/testsuite/gdc.test/runnable/implicit.d @@ -1,8 +1,9 @@ /* +REQUIRED_ARGS: -verrors=simple TEST_OUTPUT: --- -runnable/implicit.d(162): Deprecation: slice of static array temporary returned by `pureMaker3c()` assigned to longer lived variable `z1` -runnable/implicit.d(163): Deprecation: slice of static array temporary returned by `pureMaker3c()` assigned to longer lived variable `z2` +runnable/implicit.d(163): Deprecation: slice of static array temporary returned by `pureMaker3c()` assigned to longer lived variable `z1` +runnable/implicit.d(164): Deprecation: slice of static array temporary returned by `pureMaker3c()` assigned to longer lived variable `z2` --- RUN_OUTPUT: diff --git a/gcc/testsuite/gdc.test/runnable/lexer.d b/gcc/testsuite/gdc.test/runnable/lexer.d index c6ca550..18ad055 100644 --- a/gcc/testsuite/gdc.test/runnable/lexer.d +++ b/gcc/testsuite/gdc.test/runnable/lexer.d @@ -1,4 +1,4 @@ -// REQUIRED_ARGS: +// REQUIRED_ARGS: -verrors=simple /* TEST_OUTPUT: --- diff --git a/gcc/testsuite/gdc.test/runnable/test8.d b/gcc/testsuite/gdc.test/runnable/test8.d index f100762..0c08571 100644 --- a/gcc/testsuite/gdc.test/runnable/test8.d +++ b/gcc/testsuite/gdc.test/runnable/test8.d @@ -1,7 +1,8 @@ /* +REQUIRED_ARGS: -verrors=simple TEST_OUTPUT: --- -runnable/test8.d(261): Deprecation: identity comparison of static arrays implicitly coerces them to slices, which are compared by reference +runnable/test8.d(262): Deprecation: identity comparison of static arrays implicitly coerces them to slices, which are compared by reference --- */ diff --git a/gcc/testsuite/gdc.test/runnable/testsafe.d b/gcc/testsuite/gdc.test/runnable/testsafe.d index 11813a0..145250a 100644 --- a/gcc/testsuite/gdc.test/runnable/testsafe.d +++ b/gcc/testsuite/gdc.test/runnable/testsafe.d @@ -24,9 +24,9 @@ void pointercast2() int b; Object c; - static assert(!__traits(compiles, cast(void*)a)); - static assert(!__traits(compiles, cast(void*)b)); - static assert(!__traits(compiles, cast(void*)c)); + static assert(__traits(compiles, cast(void*)a)); + static assert(__traits(compiles, cast(void*)b)); + static assert(__traits(compiles, cast(void*)c)); } @safe @@ -231,11 +231,11 @@ void multablecast() static assert( __traits(compiles, cast(const(void)*)mp)); static assert( __traits(compiles, cast(const(void)*)ip)); - static assert(!__traits(compiles, cast(immutable(void)*)mp)); - static assert(!__traits(compiles, cast(immutable(void)*)cp)); + static assert(__traits(compiles, cast(immutable(void)*)mp)); + static assert(__traits(compiles, cast(immutable(void)*)cp)); - static assert(!__traits(compiles, cast(void*)cp)); - static assert(!__traits(compiles, cast(void*)ip)); + static assert(__traits(compiles, cast(void*)cp)); + static assert(__traits(compiles, cast(void*)ip)); } @safe |