mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-26 21:33:59 +08:00
d: Merge upstream dmd, druntime a88e1335f7, phobos 1921d29df.
D front-end changes: - Import dmd v2.104.1. - Deprecation phase ended for access to private method when overloaded with public method. D runtime changes: - Import druntime v2.104.1. - Linux input header translations were added to druntime. - Integration with the Valgrind `memcheck' tool has been added to the garbage collector. Phobos changes: - Import phobos v2.104.1. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd a88e1335f7. * dmd/VERSION: Bump version to v2.104.1. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime a88e1335f7. * src/MERGE: Merge upstream phobos 1921d29df. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac (libphobos-checking): Add valgrind flag. (DRUNTIME_LIBRARIES_VALGRIND): Call. * libdruntime/Makefile.am (DRUNTIME_CSOURCES): Add etc/valgrind/valgrind_.c. (DRUNTIME_DSOURCES): Add etc/valgrind/valgrind.d. (DRUNTIME_DSOURCES_LINUX): Add core/sys/linux/input.d, core/sys/linux/input_event_codes.d, core/sys/linux/uinput.d. * libdruntime/Makefile.in: Regenerate. * m4/druntime/libraries.m4 (DRUNTIME_LIBRARIES_VALGRIND): Define.
This commit is contained in:
parent
2d7c95e314
commit
e9251fea2d
@ -1,4 +1,4 @@
|
||||
17ccd12af386543c0b9935bf7e0a8e701b903105
|
||||
a88e1335f7ea767ef438c34998f5d1f26008c586
|
||||
|
||||
The first line of this file holds the git revision number of the last
|
||||
merge done from the dlang/dmd repository.
|
||||
|
@ -174,7 +174,6 @@ Note that these groups have no strict meaning, the category assignments are a bi
|
||||
| [cond.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/cond.d) | Evaluate `static if`, `version` `debug ` |
|
||||
| [staticcond.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/staticcond.d) | Lazily evaluate static conditions for `static if`, `static assert` and template constraints |
|
||||
| [delegatize.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/delegatize.d) | Converts expression to delegates for `lazy` parameters |
|
||||
| [eh.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/eh.d) | Generate tables for exception handling |
|
||||
| [nspace.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/nspace.d) | Namespace for `extern (C++, Module)` |
|
||||
| [intrange.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/intrange.d) | [Value range propagation](https://digitalmars.com/articles/b62.html) |
|
||||
| [dimport.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dimport.d) | Renamed imports (`import aliasSymbol = pkg1.pkg2.symbol`) |
|
||||
|
@ -1 +1 @@
|
||||
v2.104.0
|
||||
v2.104.1
|
||||
|
@ -16,17 +16,13 @@ module dmd.access;
|
||||
import dmd.aggregate;
|
||||
import dmd.astenums;
|
||||
import dmd.dclass;
|
||||
import dmd.declaration;
|
||||
import dmd.dmodule;
|
||||
import dmd.dscope;
|
||||
import dmd.dstruct;
|
||||
import dmd.dsymbol;
|
||||
import dmd.errors;
|
||||
import dmd.expression;
|
||||
import dmd.func;
|
||||
import dmd.globals;
|
||||
import dmd.location;
|
||||
import dmd.mtype;
|
||||
import dmd.tokens;
|
||||
|
||||
private enum LOG = false;
|
||||
|
@ -653,7 +653,8 @@ extern (C++) final class VisibilityDeclaration : AttribDeclaration
|
||||
{
|
||||
Module m = sc._module;
|
||||
|
||||
// While isAncestorPackageOf does an equality check, the fix for issue 17441 adds a check to see if
|
||||
// https://issues.dlang.org/show_bug.cgi?id=17441
|
||||
// While isAncestorPackageOf does an equality check, the fix for the issue adds a check to see if
|
||||
// each package's .isModule() properites are equal.
|
||||
//
|
||||
// Properties generated from `package(foo)` i.e. visibility.pkg have .isModule() == null.
|
||||
|
@ -80,7 +80,7 @@ extern (C++) /* CT */ BE canThrow(Expression e, FuncDeclaration func, bool mustN
|
||||
if (!f.isDtorDeclaration())
|
||||
errorSupplementalInferredAttr(f, 10, false, STC.nothrow_);
|
||||
|
||||
e.checkOverridenDtor(null, f, dd => dd.type.toTypeFunction().isnothrow, "not nothrow");
|
||||
e.checkOverriddenDtor(null, f, dd => dd.type.toTypeFunction().isnothrow, "not nothrow");
|
||||
}
|
||||
else if (func)
|
||||
{
|
||||
@ -118,7 +118,7 @@ extern (C++) /* CT */ BE canThrow(Expression e, FuncDeclaration func, bool mustN
|
||||
{
|
||||
auto sd = ts.sym;
|
||||
const id = ce.f.ident;
|
||||
if (sd.postblit && isArrayConstructionOrAssign(id))
|
||||
if (sd.postblit && isArrayConstruction(id))
|
||||
{
|
||||
checkFuncThrows(ce, sd.postblit);
|
||||
return;
|
||||
|
@ -4235,7 +4235,7 @@ final class CParser(AST) : Parser!AST
|
||||
return false;
|
||||
/*
|
||||
https://issues.dlang.org/show_bug.cgi?id=22267
|
||||
Fix issue 22267: If the parser encounters the following
|
||||
If the parser encounters the following
|
||||
`identifier variableName = (expression);`
|
||||
the initializer is not identified as such since the parentheses
|
||||
cause the parser to keep walking indefinitely
|
||||
|
@ -2922,6 +2922,7 @@ Type typeMerge(Scope* sc, EXP op, ref Expression pe1, ref Expression pe2)
|
||||
ubyte mod = MODmerge(t1.mod, t2.mod);
|
||||
t1 = t1.castMod(mod);
|
||||
t2 = t2.castMod(mod);
|
||||
return Lret(t1);
|
||||
}
|
||||
|
||||
Lagain:
|
||||
|
@ -599,7 +599,7 @@ extern (C++) final class TupleDeclaration : Declaration
|
||||
|
||||
override const(char)* kind() const
|
||||
{
|
||||
return "tuple";
|
||||
return "sequence";
|
||||
}
|
||||
|
||||
override Type getType()
|
||||
|
@ -2412,7 +2412,7 @@ public:
|
||||
continue;
|
||||
if (ex.op == EXP.voidExpression)
|
||||
{
|
||||
e.error("CTFE internal error: void element `%s` in tuple", exp.toChars());
|
||||
e.error("CTFE internal error: void element `%s` in sequence", exp.toChars());
|
||||
assert(0);
|
||||
}
|
||||
|
||||
@ -3890,7 +3890,7 @@ public:
|
||||
newval = copyLiteral(newval).copy();
|
||||
assignInPlace(oldval, newval);
|
||||
}
|
||||
else if (wantCopy && e.op == EXP.assign)
|
||||
else if (wantCopy && (e.op == EXP.assign || e.op == EXP.loweredAssignExp))
|
||||
{
|
||||
// Currently postblit/destructor calls on static array are done
|
||||
// in the druntime internal functions so they don't appear in AST.
|
||||
@ -4299,7 +4299,7 @@ public:
|
||||
rb.newval = newval;
|
||||
rb.refCopy = wantRef || cow;
|
||||
rb.needsPostblit = sd && sd.postblit && e.op != EXP.blit && e.e2.isLvalue();
|
||||
rb.needsDtor = sd && sd.dtor && e.op == EXP.assign;
|
||||
rb.needsDtor = sd && sd.dtor && (e.op == EXP.assign || e.op == EXP.loweredAssignExp);
|
||||
if (Expression ex = rb.assignTo(existingAE, cast(size_t)lowerbound, cast(size_t)upperbound))
|
||||
return ex;
|
||||
|
||||
@ -4773,12 +4773,11 @@ public:
|
||||
result = CTFEExp.voidexp;
|
||||
return;
|
||||
}
|
||||
else if (isArrayConstructionOrAssign(fd.ident))
|
||||
else if (isArrayConstruction(fd.ident))
|
||||
{
|
||||
// In expressionsem.d, the following lowerings were performed:
|
||||
// * `T[x] ea = eb;` to `_d_array{,set}ctor(ea[], eb[]);`.
|
||||
// * `ea = eb` to `_d_array{,setassign,assign_l,assign_r}(ea[], eb)`.
|
||||
// The following code will rewrite them back to `ea = eb` and
|
||||
// In expressionsem.d, `T[x] ea = eb;` was lowered to:
|
||||
// `_d_array{,set}ctor(ea[], eb[]);`.
|
||||
// The following code will rewrite it back to `ea = eb` and
|
||||
// then interpret that expression.
|
||||
|
||||
if (fd.ident == Id._d_arrayctor)
|
||||
@ -4791,17 +4790,14 @@ public:
|
||||
ea = ea.isCastExp.e1;
|
||||
|
||||
Expression eb = (*e.arguments)[1];
|
||||
if (eb.isCastExp() && fd.ident != Id._d_arraysetctor)
|
||||
if (eb.isCastExp() && fd.ident == Id._d_arrayctor)
|
||||
eb = eb.isCastExp.e1;
|
||||
|
||||
Expression rewrittenExp;
|
||||
if (fd.ident == Id._d_arrayctor || fd.ident == Id._d_arraysetctor)
|
||||
rewrittenExp = new ConstructExp(e.loc, ea, eb);
|
||||
else
|
||||
rewrittenExp = new AssignExp(e.loc, ea, eb);
|
||||
ConstructExp ce = new ConstructExp(e.loc, ea, eb);
|
||||
ce.type = ea.type;
|
||||
|
||||
rewrittenExp.type = ea.type;
|
||||
result = interpret(rewrittenExp, istate);
|
||||
ce.type = ea.type;
|
||||
result = interpret(ce, istate);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -888,7 +888,7 @@ public:
|
||||
buf.writeByte('V');
|
||||
if (ea.op == EXP.tuple)
|
||||
{
|
||||
ea.error("tuple is not a valid template value argument");
|
||||
ea.error("sequence is not a valid template value argument");
|
||||
continue;
|
||||
}
|
||||
// Now that we know it is not an alias, we MUST obtain a value
|
||||
|
@ -53,6 +53,10 @@ import dmd.target;
|
||||
import dmd.utils;
|
||||
import dmd.visitor;
|
||||
|
||||
version (IN_GCC) {}
|
||||
else version (IN_LLVM) {}
|
||||
else version = MARS;
|
||||
|
||||
// function used to call semantic3 on a module's dependencies
|
||||
void semantic3OnDependencies(Module m)
|
||||
{
|
||||
@ -615,9 +619,18 @@ extern (C++) final class Module : Package
|
||||
if (FileName.equals(srcfile.toString(), "object.d"))
|
||||
{
|
||||
.error(loc, "cannot find source code for runtime library file 'object.d'");
|
||||
errorSupplemental(loc, "dmd might not be correctly installed. Run 'dmd -man' for installation instructions.");
|
||||
const dmdConfFile = global.inifilename.length ? FileName.canonicalName(global.inifilename) : "not found";
|
||||
errorSupplemental(loc, "config file: %.*s", cast(int)dmdConfFile.length, dmdConfFile.ptr);
|
||||
version (IN_LLVM)
|
||||
{
|
||||
errorSupplemental(loc, "ldc2 might not be correctly installed.");
|
||||
errorSupplemental(loc, "Please check your ldc2.conf configuration file.");
|
||||
errorSupplemental(loc, "Installation instructions can be found at http://wiki.dlang.org/LDC.");
|
||||
}
|
||||
version (MARS)
|
||||
{
|
||||
errorSupplemental(loc, "dmd might not be correctly installed. Run 'dmd -man' for installation instructions.");
|
||||
const dmdConfFile = global.inifilename.length ? FileName.canonicalName(global.inifilename) : "not found";
|
||||
errorSupplemental(loc, "config file: %.*s", cast(int)dmdConfFile.length, dmdConfFile.ptr);
|
||||
}
|
||||
}
|
||||
else if (FileName.ext(this.arg) || !loc.isValid())
|
||||
{
|
||||
|
@ -587,6 +587,8 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
||||
const loc = (s ? s : dsym).loc;
|
||||
loc.errorSupplemental("required by type `%s`", dsym.type.toChars());
|
||||
}
|
||||
errorSupplemental(dsym.loc, "see https://dlang.org/spec/struct.html#opaque_struct_unions");
|
||||
errorSupplemental(dsym.loc, "perhaps declare a variable with pointer type `%s*` instead", dsym.type.toChars());
|
||||
|
||||
// Flag variable as error to avoid invalid error messages due to unknown size
|
||||
dsym.type = Type.terror;
|
||||
@ -693,7 +695,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
||||
size_t tedim = te.exps.length;
|
||||
if (tedim != nelems)
|
||||
{
|
||||
error(dsym.loc, "tuple of %d elements cannot be assigned to tuple of %d elements", cast(int)tedim, cast(int)nelems);
|
||||
error(dsym.loc, "sequence of %d elements cannot be assigned to sequence of %d elements", cast(int)tedim, cast(int)nelems);
|
||||
for (size_t u = tedim; u < nelems; u++) // fill dummy expression
|
||||
te.exps.push(ErrorExp.get());
|
||||
}
|
||||
@ -2042,7 +2044,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
||||
{
|
||||
}
|
||||
else
|
||||
ns.exp.error("compile time string constant (or tuple) expected, not `%s`",
|
||||
ns.exp.error("compile time string constant (or sequence) expected, not `%s`",
|
||||
ns.exp.toChars());
|
||||
attribSemantic(ns);
|
||||
}
|
||||
@ -2712,7 +2714,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
||||
}
|
||||
if (i + 1 != tempdecl.parameters.length && tp.isTemplateTupleParameter())
|
||||
{
|
||||
tempdecl.error("template tuple parameter must be last one");
|
||||
tempdecl.error("template sequence parameter must be the last one");
|
||||
tempdecl.errors = true;
|
||||
}
|
||||
}
|
||||
@ -3963,13 +3965,13 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
||||
hgs.fullQual = true;
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23745
|
||||
// If the potentially overriden function contains errors,
|
||||
// If the potentially overridden function contains errors,
|
||||
// inform the user to fix that one first
|
||||
if (fd.errors)
|
||||
{
|
||||
error(funcdecl.loc, "function `%s` does not override any function, did you mean to override `%s`?",
|
||||
funcdecl.toChars(), fd.toPrettyChars());
|
||||
errorSupplemental(fd.loc, "Function `%s` contains errors in its declaration, therefore it cannot be correctly overriden",
|
||||
errorSupplemental(fd.loc, "Function `%s` contains errors in its declaration, therefore it cannot be correctly overridden",
|
||||
fd.toPrettyChars());
|
||||
}
|
||||
else
|
||||
@ -3985,7 +3987,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
||||
{
|
||||
error(funcdecl.loc, "function `%s` does not override any function, did you mean to override %s `%s`?",
|
||||
funcdeclToChars, s.kind, s.toPrettyChars());
|
||||
errorSupplemental(funcdecl.loc, "Functions are the only declarations that may be overriden");
|
||||
errorSupplemental(funcdecl.loc, "Functions are the only declarations that may be overridden");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -5897,6 +5899,31 @@ void addEnumMembers(EnumDeclaration ed, Scope* sc, ScopeDsymbol sds)
|
||||
});
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
* Verifies if the given Identifier is a DRuntime hook. It uses the hooks
|
||||
* defined in `id.d`.
|
||||
*
|
||||
* Params:
|
||||
* id = Identifier to verify
|
||||
* Returns:
|
||||
* true if `id` is a DRuntime hook
|
||||
* false otherwise
|
||||
*/
|
||||
private bool isDRuntimeHook(Identifier id)
|
||||
{
|
||||
return id == Id._d_HookTraceImpl ||
|
||||
id == Id._d_newclassT || id == Id._d_newclassTTrace ||
|
||||
id == Id._d_arraycatnTX || id == Id._d_arraycatnTXTrace ||
|
||||
id == Id._d_newThrowable || id == Id._d_delThrowable ||
|
||||
id == Id._d_arrayassign_l || id == Id._d_arrayassign_r ||
|
||||
id == Id._d_arraysetassign || id == Id._d_arraysetctor ||
|
||||
id == Id._d_arrayctor ||
|
||||
id == Id._d_arraysetlengthTImpl || id == Id._d_arraysetlengthT ||
|
||||
id == Id._d_arraysetlengthTTrace ||
|
||||
id == Id._d_arrayappendT || id == Id._d_arrayappendTTrace ||
|
||||
id == Id._d_arrayappendcTXImpl;
|
||||
}
|
||||
|
||||
void templateInstanceSemantic(TemplateInstance tempinst, Scope* sc, ArgumentList argumentList)
|
||||
{
|
||||
//printf("[%s] TemplateInstance.dsymbolSemantic('%s', this=%p, gag = %d, sc = %p)\n", tempinst.loc.toChars(), tempinst.toChars(), tempinst, global.gag, sc);
|
||||
@ -6376,8 +6403,20 @@ void templateInstanceSemantic(TemplateInstance tempinst, Scope* sc, ArgumentList
|
||||
tempinst.deferred = &deferred;
|
||||
|
||||
//printf("Run semantic3 on %s\n", toChars());
|
||||
|
||||
/* https://issues.dlang.org/show_bug.cgi?id=23965
|
||||
* DRuntime hooks are not deprecated, but may be used for deprecated
|
||||
* types. Deprecations are disabled while analysing hooks to avoid
|
||||
* spurious error messages.
|
||||
*/
|
||||
auto saveUseDeprecated = global.params.useDeprecated;
|
||||
if (sc.isDeprecated() && isDRuntimeHook(tempinst.name))
|
||||
global.params.useDeprecated = DiagnosticReporting.off;
|
||||
|
||||
tempinst.trySemantic3(sc2);
|
||||
|
||||
global.params.useDeprecated = saveUseDeprecated;
|
||||
|
||||
for (size_t i = 0; i < deferred.length; i++)
|
||||
{
|
||||
//printf("+ run deferred semantic3 on %s\n", deferred[i].toChars());
|
||||
|
@ -1302,36 +1302,19 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
|
||||
|
||||
/*************************************************
|
||||
* Match function arguments against a specific template function.
|
||||
* Input:
|
||||
* ti
|
||||
* sc instantiation scope
|
||||
* fd
|
||||
* tthis 'this' argument if !NULL
|
||||
* argumentList arguments to function
|
||||
* Output:
|
||||
* fd Partially instantiated function declaration
|
||||
* ti.tdtypes Expression/Type deduced template arguments
|
||||
*
|
||||
* Params:
|
||||
* ti = template instance. `ti.tdtypes` will be set to Expression/Type deduced template arguments
|
||||
* sc = instantiation scope
|
||||
* fd = Partially instantiated function declaration, which is set to an instantiated function declaration
|
||||
* tthis = 'this' argument if !NULL
|
||||
* argumentList = arguments to function
|
||||
*
|
||||
* Returns:
|
||||
* match pair of initial and inferred template arguments
|
||||
*/
|
||||
extern (D) MATCHpair deduceFunctionTemplateMatch(TemplateInstance ti, Scope* sc, ref FuncDeclaration fd, Type tthis, ArgumentList argumentList)
|
||||
{
|
||||
size_t nfparams;
|
||||
size_t nfargs;
|
||||
size_t ntargs; // array size of tiargs
|
||||
size_t fptupindex = IDX_NOTFOUND;
|
||||
MATCH match = MATCH.exact;
|
||||
MATCH matchTiargs = MATCH.exact;
|
||||
ParameterList fparameters; // function parameter list
|
||||
VarArg fvarargs; // function varargs
|
||||
uint wildmatch = 0;
|
||||
size_t inferStart = 0;
|
||||
|
||||
Loc instLoc = ti.loc;
|
||||
Objects* tiargs = ti.tiargs;
|
||||
auto dedargs = new Objects(parameters.length);
|
||||
Objects* dedtypes = &ti.tdtypes; // for T:T*, the dedargs is the T*, dedtypes is the T
|
||||
|
||||
version (none)
|
||||
{
|
||||
printf("\nTemplateDeclaration.deduceFunctionTemplateMatch() %s\n", toChars());
|
||||
@ -1348,8 +1331,10 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
|
||||
|
||||
assert(_scope);
|
||||
|
||||
auto dedargs = new Objects(parameters.length);
|
||||
dedargs.zero();
|
||||
|
||||
Objects* dedtypes = &ti.tdtypes; // for T:T*, the dedargs is the T*, dedtypes is the T
|
||||
dedtypes.setDim(parameters.length);
|
||||
dedtypes.zero();
|
||||
|
||||
@ -1393,8 +1378,12 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
|
||||
}
|
||||
}
|
||||
|
||||
ntargs = 0;
|
||||
if (tiargs)
|
||||
size_t ntargs = 0; // array size of tiargs
|
||||
size_t inferStart = 0; // index of first parameter to infer
|
||||
const Loc instLoc = ti.loc;
|
||||
MATCH matchTiargs = MATCH.exact;
|
||||
|
||||
if (auto tiargs = ti.tiargs)
|
||||
{
|
||||
// Set initial template arguments
|
||||
ntargs = tiargs.length;
|
||||
@ -1460,9 +1449,9 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
|
||||
}
|
||||
}
|
||||
|
||||
fparameters = fd.getParameterList();
|
||||
nfparams = fparameters.length; // number of function parameters
|
||||
nfargs = argumentList.length; // number of function arguments
|
||||
ParameterList fparameters = fd.getParameterList(); // function parameter list
|
||||
const nfparams = fparameters.length; // number of function parameters
|
||||
const nfargs = argumentList.length; // number of function arguments
|
||||
if (argumentList.hasNames)
|
||||
return matcherror(); // TODO: resolve named args
|
||||
Expressions* fargs = argumentList.arguments; // TODO: resolve named args
|
||||
@ -1473,6 +1462,7 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
|
||||
* void foo(T, A...)(T t, A a);
|
||||
* void main() { foo(1,2,3); }
|
||||
*/
|
||||
size_t fptupindex = IDX_NOTFOUND;
|
||||
if (tp) // if variadic
|
||||
{
|
||||
// TemplateTupleParameter always makes most lesser matching.
|
||||
@ -1515,6 +1505,7 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
|
||||
}
|
||||
}
|
||||
|
||||
MATCH match = MATCH.exact;
|
||||
if (toParent().isModule())
|
||||
tthis = null;
|
||||
if (tthis)
|
||||
@ -1579,6 +1570,7 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
|
||||
//printf("\ttp = %p, fptupindex = %d, found = %d, declaredTuple = %s\n", tp, fptupindex, fptupindex != IDX_NOTFOUND, declaredTuple ? declaredTuple.toChars() : NULL);
|
||||
size_t argi = 0;
|
||||
size_t nfargs2 = nfargs; // nfargs + supplied defaultArgs
|
||||
uint inoutMatch = 0; // for debugging only
|
||||
for (size_t parami = 0; parami < nfparams; parami++)
|
||||
{
|
||||
Parameter fparam = fparameters[parami];
|
||||
@ -1643,7 +1635,7 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
|
||||
MATCH m;
|
||||
if (ubyte wm = deduceWildHelper(farg.type, &tt, tid))
|
||||
{
|
||||
wildmatch |= wm;
|
||||
inoutMatch |= wm;
|
||||
m = MATCH.constant;
|
||||
}
|
||||
else
|
||||
@ -1896,10 +1888,10 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
|
||||
if (fparameters.varargs == VarArg.typesafe && parami + 1 == nfparams && argi + 1 < nfargs)
|
||||
goto Lvarargs;
|
||||
|
||||
uint wm = 0;
|
||||
MATCH m = deduceType(oarg, paramscope, prmtype, parameters, dedtypes, &wm, inferStart);
|
||||
//printf("\tL%d deduceType m = %d, wm = x%x, wildmatch = x%x\n", __LINE__, m, wm, wildmatch);
|
||||
wildmatch |= wm;
|
||||
uint im = 0;
|
||||
MATCH m = deduceType(oarg, paramscope, prmtype, parameters, dedtypes, &im, inferStart);
|
||||
//printf("\tL%d deduceType m = %d, im = x%x, inoutMatch = x%x\n", __LINE__, m, im, inoutMatch);
|
||||
inoutMatch |= im;
|
||||
|
||||
/* If no match, see if the argument can be matched by using
|
||||
* implicit conversions.
|
||||
@ -2087,7 +2079,7 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
|
||||
{
|
||||
uint wm = 0;
|
||||
m = deduceType(arg, paramscope, ta.next, parameters, dedtypes, &wm, inferStart);
|
||||
wildmatch |= wm;
|
||||
inoutMatch |= wm;
|
||||
}
|
||||
if (m == MATCH.nomatch)
|
||||
return nomatch();
|
||||
|
@ -2450,7 +2450,7 @@ public:
|
||||
{
|
||||
debug (Debug_DtoH) mixin(traceVisit!e);
|
||||
|
||||
// Valid in most cases, others should be overriden below
|
||||
// Valid in most cases, others should be overridden below
|
||||
// to use the appropriate operators (:: and ->)
|
||||
buf.writestring(e.toString());
|
||||
}
|
||||
|
@ -93,22 +93,7 @@ bool checkMutableArguments(Scope* sc, FuncDeclaration fd, TypeFunction tf,
|
||||
bool isMutable; // true if reference to mutable
|
||||
}
|
||||
|
||||
/* Store escapeBy as static data escapeByStorage so we can keep reusing the same
|
||||
* arrays rather than reallocating them.
|
||||
*/
|
||||
__gshared EscapeBy[] escapeByStorage;
|
||||
auto escapeBy = escapeByStorage;
|
||||
if (escapeBy.length < len)
|
||||
{
|
||||
auto newPtr = cast(EscapeBy*)mem.xrealloc(escapeBy.ptr, len * EscapeBy.sizeof);
|
||||
// Clear the new section
|
||||
memset(newPtr + escapeBy.length, 0, (len - escapeBy.length) * EscapeBy.sizeof);
|
||||
escapeBy = newPtr[0 .. len];
|
||||
escapeByStorage = escapeBy;
|
||||
}
|
||||
else
|
||||
escapeBy = escapeBy[0 .. len];
|
||||
|
||||
auto escapeBy = new EscapeBy[len];
|
||||
const paramLength = tf.parameterList.length;
|
||||
|
||||
// Fill in escapeBy[] with arguments[], ethis, and outerVars[]
|
||||
@ -181,7 +166,7 @@ bool checkMutableArguments(Scope* sc, FuncDeclaration fd, TypeFunction tf,
|
||||
if (!(eb.isMutable || eb2.isMutable))
|
||||
return;
|
||||
|
||||
if (!tf.islive && !(global.params.useDIP1000 == FeatureState.enabled && sc.func.setUnsafe()))
|
||||
if (!tf.islive && !(global.params.useDIP1000 == FeatureState.enabled && sc.func && sc.func.setUnsafe()))
|
||||
return;
|
||||
|
||||
if (!gag)
|
||||
@ -228,13 +213,6 @@ bool checkMutableArguments(Scope* sc, FuncDeclaration fd, TypeFunction tf,
|
||||
escape(i, eb, false);
|
||||
}
|
||||
|
||||
/* Reset the arrays in escapeBy[] so we can reuse them next time through
|
||||
*/
|
||||
foreach (ref eb; escapeBy)
|
||||
{
|
||||
eb.er.reset();
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
@ -387,8 +365,9 @@ bool checkParamArgumentEscape(Scope* sc, FuncDeclaration fdc, Identifier parId,
|
||||
(!fdc && parId) ? (desc ~ " `%s` assigned to non-scope parameter `%s`") :
|
||||
(desc ~ " `%s` assigned to non-scope anonymous parameter");
|
||||
|
||||
auto param = isThis ? v : (parId ? parId : fdc);
|
||||
if (sc.setUnsafeDIP1000(gag, arg.loc, msg, v, param, fdc))
|
||||
if (isThis ?
|
||||
sc.setUnsafeDIP1000(gag, arg.loc, msg, arg, fdc.toParent2(), fdc) :
|
||||
sc.setUnsafeDIP1000(gag, arg.loc, msg, v, parId ? parId : fdc, fdc))
|
||||
{
|
||||
result = true;
|
||||
printScopeFailure(previewSupplementalFunc(sc.isDeprecated(), global.params.useDIP1000), vPar, 10);
|
||||
@ -508,7 +487,7 @@ bool checkParamArgumentReturn(Scope* sc, Expression firstArg, Expression arg, Pa
|
||||
const byRef = param.isReference() && !(param.storageClass & STC.scope_)
|
||||
&& !(param.storageClass & STC.returnScope); // fixme: it's possible to infer returnScope without scope with vaIsFirstRef
|
||||
|
||||
scope e = new AssignExp(arg.loc, firstArg, arg);
|
||||
auto e = new AssignExp(arg.loc, firstArg, arg);
|
||||
return checkAssignEscape(sc, e, gag, byRef);
|
||||
}
|
||||
|
||||
@ -2487,6 +2466,9 @@ bool isReferenceToMutable(Type t)
|
||||
}
|
||||
break;
|
||||
|
||||
case Tnull:
|
||||
return false;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
@ -1242,7 +1242,7 @@ extern (C++) abstract class Expression : ASTNode
|
||||
if (!f.isDtorDeclaration())
|
||||
errorSupplementalInferredAttr(f, /*max depth*/ 10, /*deprecation*/ false, STC.pure_);
|
||||
|
||||
checkOverridenDtor(sc, f, dd => dd.type.toTypeFunction().purity != PURE.impure, "impure");
|
||||
checkOverriddenDtor(sc, f, dd => dd.type.toTypeFunction().purity != PURE.impure, "impure");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1261,7 +1261,7 @@ extern (C++) abstract class Expression : ASTNode
|
||||
* check = current check (e.g. whether it's pure)
|
||||
* checkName = the kind of check (e.g. `"pure"`)
|
||||
*/
|
||||
extern (D) final void checkOverridenDtor(Scope* sc, FuncDeclaration f,
|
||||
extern (D) final void checkOverriddenDtor(Scope* sc, FuncDeclaration f,
|
||||
scope bool function(DtorDeclaration) check, const string checkName
|
||||
) {
|
||||
auto dd = f.isDtorDeclaration();
|
||||
@ -1314,7 +1314,7 @@ extern (C++) abstract class Expression : ASTNode
|
||||
field.loc.errorSupplemental(" - %s %s", field.type.toChars(), field.toChars());
|
||||
|
||||
if (fieldSd.dtor.isGenerated())
|
||||
checkOverridenDtor(sc, fieldSd.dtor, check, checkName);
|
||||
checkOverriddenDtor(sc, fieldSd.dtor, check, checkName);
|
||||
else
|
||||
fieldSd.dtor.loc.errorSupplemental(" %.*s `%s.~this` is declared here",
|
||||
cast(int) checkName.length, checkName.ptr, fieldSd.toChars());
|
||||
@ -1505,7 +1505,7 @@ extern (C++) abstract class Expression : ASTNode
|
||||
errorSupplementalInferredAttr(f, /*max depth*/ 10, /*deprecation*/ false, STC.safe);
|
||||
.errorSupplemental(f.loc, "`%s` is declared here", prettyChars);
|
||||
|
||||
checkOverridenDtor(sc, f, dd => dd.type.toTypeFunction().trust > TRUST.system, "@system");
|
||||
checkOverriddenDtor(sc, f, dd => dd.type.toTypeFunction().trust > TRUST.system, "@system");
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1569,7 +1569,7 @@ extern (C++) abstract class Expression : ASTNode
|
||||
f.errorSupplementalInferredAttr(/*max depth*/ 10, /*deprecation*/ false, STC.nogc);
|
||||
}
|
||||
|
||||
checkOverridenDtor(sc, f, dd => dd.type.toTypeFunction().isnogc, "non-@nogc");
|
||||
checkOverriddenDtor(sc, f, dd => dd.type.toTypeFunction().isnogc, "non-@nogc");
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -4512,7 +4512,7 @@ extern (C++) abstract class BinExp : Expression
|
||||
Type t2 = e2.type;
|
||||
|
||||
// T opAssign floating yields a floating. Prevent truncating conversions (float to int).
|
||||
// See issue 3841.
|
||||
// See https://issues.dlang.org/show_bug.cgi?id=3841.
|
||||
// Should we also prevent double to float (type.isfloating() && type.size() < t2.size()) ?
|
||||
if (op == EXP.addAssign || op == EXP.minAssign ||
|
||||
op == EXP.mulAssign || op == EXP.divAssign || op == EXP.modAssign ||
|
||||
@ -7425,23 +7425,20 @@ extern(D) Modifiable checkModifiable(Expression exp, Scope* sc, ModifyFlags flag
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if the given identifier is any of
|
||||
* _d_array{ctor,setctor,setassign,assign_l, assign_r}.
|
||||
* Verify if the given identifier is _d_array{,set}ctor.
|
||||
*
|
||||
* Params:
|
||||
* id = the identifier to verify
|
||||
*
|
||||
* Returns:
|
||||
* `true` if the identifier corresponds to a construction of assignement
|
||||
* runtime hook, `false` otherwise.
|
||||
* `true` if the identifier corresponds to a construction runtime hook,
|
||||
* `false` otherwise.
|
||||
*/
|
||||
bool isArrayConstructionOrAssign(const Identifier id)
|
||||
bool isArrayConstruction(const Identifier id)
|
||||
{
|
||||
import dmd.id : Id;
|
||||
|
||||
return id == Id._d_arrayctor || id == Id._d_arraysetctor ||
|
||||
id == Id._d_arrayassign_l || id == Id._d_arrayassign_r ||
|
||||
id == Id._d_arraysetassign;
|
||||
return id == Id._d_arrayctor || id == Id._d_arraysetctor;
|
||||
}
|
||||
|
||||
/******************************
|
||||
|
@ -386,34 +386,6 @@ Expression checkNoreturnVarAccess(Expression exp)
|
||||
return result;
|
||||
}
|
||||
|
||||
/******************************
|
||||
* Check the tail CallExp is really property function call.
|
||||
* Bugs:
|
||||
* This doesn't appear to do anything.
|
||||
*/
|
||||
private bool checkPropertyCall(Expression e)
|
||||
{
|
||||
e = lastComma(e);
|
||||
|
||||
if (auto ce = e.isCallExp())
|
||||
{
|
||||
if (ce.f)
|
||||
{
|
||||
auto tf = ce.f.type.isTypeFunction();
|
||||
/* If a forward reference to ce.f, try to resolve it
|
||||
*/
|
||||
if (!tf.deco && ce.f.semanticRun < PASS.semanticdone)
|
||||
{
|
||||
ce.f.dsymbolSemantic(null);
|
||||
tf = ce.f.type.isTypeFunction();
|
||||
}
|
||||
}
|
||||
else if (!ce.e1.type.isFunction_Delegate_PtrToFunction())
|
||||
assert(0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/******************************
|
||||
* Find symbol in accordance with the UFCS name look up rule
|
||||
*/
|
||||
@ -489,6 +461,15 @@ private Expression searchUFCS(Scope* sc, UnaExp ue, Identifier ident)
|
||||
|
||||
if (auto dti = ue.isDotTemplateInstanceExp())
|
||||
{
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23968
|
||||
// Typically, deprecated alias declarations are caught
|
||||
// when `TemplateInstance.findTempDecl` is called,
|
||||
// however, in this case the tempdecl field is updated
|
||||
// therefore `findTempDecl` will return immediately
|
||||
// and not get the chance to issue the deprecation.
|
||||
if (s.isAliasDeclaration())
|
||||
s.checkDeprecated(ue.loc, sc);
|
||||
|
||||
auto ti = new TemplateInstance(loc, s.ident, dti.ti.tiargs);
|
||||
if (!ti.updateTempDecl(sc, s))
|
||||
return ErrorExp.get();
|
||||
@ -717,7 +698,6 @@ private Expression resolveUFCSProperties(Scope* sc, Expression e1, Expression e2
|
||||
}
|
||||
else if (ex && !e)
|
||||
{
|
||||
checkPropertyCall(ex);
|
||||
ex = new AssignExp(loc, ex, e2);
|
||||
return ex.expressionSemantic(sc);
|
||||
}
|
||||
@ -726,7 +706,6 @@ private Expression resolveUFCSProperties(Scope* sc, Expression e1, Expression e2
|
||||
// strict setter prints errors if fails
|
||||
e = e.expressionSemantic(sc);
|
||||
}
|
||||
checkPropertyCall(e);
|
||||
return e;
|
||||
}
|
||||
else
|
||||
@ -736,9 +715,13 @@ private Expression resolveUFCSProperties(Scope* sc, Expression e1, Expression e2
|
||||
auto arguments = new Expressions(1);
|
||||
(*arguments)[0] = eleft;
|
||||
e = new CallExp(loc, e, arguments);
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=24017
|
||||
if (sc.flags & SCOPE.debug_)
|
||||
e.isCallExp().inDebugStatement = true;
|
||||
|
||||
e = e.expressionSemantic(sc);
|
||||
checkPropertyCall(e);
|
||||
return e.expressionSemantic(sc);
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1189,6 +1172,13 @@ L1:
|
||||
*/
|
||||
private bool haveSameThis(FuncDeclaration outerFunc, FuncDeclaration calledFunc)
|
||||
{
|
||||
// https://issues.dlang.org/show_bug.cgi?id=24013
|
||||
// traits(getOverloads) inserts an alias to select the overload.
|
||||
// When searching for the right this we need to use the aliased
|
||||
// overload/function, not the alias.
|
||||
outerFunc = outerFunc.toAliasFunc();
|
||||
calledFunc = calledFunc.toAliasFunc();
|
||||
|
||||
auto thisAd = outerFunc.isMemberLocal();
|
||||
if (!thisAd)
|
||||
return false;
|
||||
@ -1386,15 +1376,6 @@ private Expression resolvePropertiesX(Scope* sc, Expression e1, Expression e2 =
|
||||
{
|
||||
if (fd.errors)
|
||||
return ErrorExp.get();
|
||||
if (!checkSymbolAccess(sc, fd))
|
||||
{
|
||||
// @@@DEPRECATED_2.105@@@
|
||||
// When turning into error, uncomment the return statement
|
||||
TypeFunction tf = fd.type.isTypeFunction();
|
||||
deprecation(loc, "function `%s` of type `%s` is not accessible from module `%s`",
|
||||
fd.toPrettyChars(), tf.toChars, sc._module.toChars);
|
||||
//return ErrorExp.get();
|
||||
}
|
||||
assert(fd.type.ty == Tfunction);
|
||||
Expression e = new CallExp(loc, e1, e2);
|
||||
return e.expressionSemantic(sc);
|
||||
@ -1409,14 +1390,6 @@ private Expression resolvePropertiesX(Scope* sc, Expression e1, Expression e2 =
|
||||
TypeFunction tf = fd.type.isTypeFunction();
|
||||
if (!e2 || tf.isref)
|
||||
{
|
||||
if (!checkSymbolAccess(sc, fd))
|
||||
{
|
||||
// @@@DEPRECATED_2.105@@@
|
||||
// When turning into error, uncomment the return statement
|
||||
deprecation(loc, "function `%s` of type `%s` is not accessible from module `%s`",
|
||||
fd.toPrettyChars(), tf.toChars, sc._module.toChars);
|
||||
//return ErrorExp.get();
|
||||
}
|
||||
Expression e = new CallExp(loc, e1);
|
||||
if (e2)
|
||||
{
|
||||
@ -3404,7 +3377,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||
if (ve && ve.var && exp.parens && !ve.var.isStatic() && !(sc.stc & STC.static_) &&
|
||||
sc.func && sc.func.needThis && ve.var.isMember2())
|
||||
{
|
||||
// printf("apply fix for issue 9490: add `this.` to `%s`...\n", e.toChars());
|
||||
// printf("apply fix for bugzilla issue 9490: add `this.` to `%s`...\n", e.toChars());
|
||||
e = new DotVarExp(exp.loc, new ThisExp(exp.loc), ve.var, false);
|
||||
}
|
||||
//printf("e = %s %s\n", Token.toChars(e.op), e.toChars());
|
||||
@ -4092,9 +4065,10 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||
if (arg.op == EXP.error)
|
||||
return setError();
|
||||
arg = arg.optimize(WANTvalue);
|
||||
if (arg.op == EXP.int64 && cast(sinteger_t)arg.toInteger() < 0)
|
||||
if (arg.op == EXP.int64 && (target.isLP64 ?
|
||||
cast(sinteger_t)arg.toInteger() : cast(int)arg.toInteger()) < 0)
|
||||
{
|
||||
exp.error("negative array index `%s`", arg.toChars());
|
||||
exp.error("negative array dimension `%s`", (*exp.arguments)[i].toChars());
|
||||
return setError();
|
||||
}
|
||||
(*exp.arguments)[i] = arg;
|
||||
@ -5024,7 +4998,21 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||
|
||||
if (!exp.ignoreAttributes)
|
||||
checkFunctionAttributes(exp, sc, exp.f);
|
||||
checkAccess(exp.loc, sc, ue.e1, exp.f);
|
||||
|
||||
// Cut-down version of checkAccess() that doesn't use the "most visible" version of exp.f.
|
||||
// We've already selected an overload here.
|
||||
const parent = exp.f.toParent();
|
||||
if (parent && parent.isTemplateInstance())
|
||||
{
|
||||
// already a deprecation
|
||||
}
|
||||
else if (!checkSymbolAccess(sc, exp.f))
|
||||
{
|
||||
exp.error("%s `%s` of type `%s` is not accessible from module `%s`",
|
||||
exp.f.kind(), exp.f.toPrettyChars(), exp.f.type.toChars(), sc._module.toChars);
|
||||
return setError();
|
||||
}
|
||||
|
||||
if (!exp.f.needThis())
|
||||
{
|
||||
exp.e1 = Expression.combine(ue.e1, new VarExp(exp.loc, exp.f, false));
|
||||
@ -7828,7 +7816,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||
|
||||
if (exp.to.ty == Ttuple)
|
||||
{
|
||||
exp.error("cannot cast `%s` of type `%s` to tuple type `%s`", exp.e1.toChars(), exp.e1.type.toChars(), exp.to.toChars());
|
||||
exp.error("cannot cast `%s` of type `%s` to type sequence `%s`", exp.e1.toChars(), exp.e1.type.toChars(), exp.to.toChars());
|
||||
return setError();
|
||||
}
|
||||
|
||||
@ -8174,7 +8162,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||
}
|
||||
if (!exp.lwr || !exp.upr)
|
||||
{
|
||||
exp.error("need upper and lower bound to slice tuple");
|
||||
exp.error("need upper and lower bound to slice a sequence");
|
||||
return setError();
|
||||
}
|
||||
}
|
||||
@ -9219,7 +9207,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||
Expression e = null;
|
||||
if (dim != tup2.exps.length)
|
||||
{
|
||||
exp.error("mismatched tuple lengths, %d and %d", cast(int)dim, cast(int)tup2.exps.length);
|
||||
exp.error("mismatched sequence lengths, %d and %d", cast(int)dim, cast(int)tup2.exps.length);
|
||||
return setError();
|
||||
}
|
||||
if (dim == 0)
|
||||
@ -10363,6 +10351,9 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||
if (global.params.verbose)
|
||||
message("lowered %s =>\n %s", ae.toChars(), res.toChars());
|
||||
|
||||
res = new LoweredAssignExp(ae, res);
|
||||
res.type = ae.type;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -927,7 +927,7 @@ public:
|
||||
}
|
||||
if (d.decl.length == 0 || (hgs.hdrgen && d.decl.length == 1 && (*d.decl)[0].isUnitTestDeclaration()))
|
||||
{
|
||||
// hack for bugzilla 8081
|
||||
// hack for https://issues.dlang.org/show_bug.cgi?id=8081
|
||||
if (hasSTC) buf.writeByte(' ');
|
||||
buf.writestring("{}");
|
||||
}
|
||||
@ -2217,13 +2217,13 @@ private void expressionPrettyPrint(Expression e, OutBuffer* buf, HdrGenState* hg
|
||||
{
|
||||
buf.writeByte('(');
|
||||
e.e0.expressionPrettyPrint(buf, hgs);
|
||||
buf.writestring(", tuple(");
|
||||
buf.writestring(", AliasSeq!(");
|
||||
argsToBuffer(e.exps, buf, hgs);
|
||||
buf.writestring("))");
|
||||
}
|
||||
else
|
||||
{
|
||||
buf.writestring("tuple(");
|
||||
buf.writestring("AliasSeq!(");
|
||||
argsToBuffer(e.exps, buf, hgs);
|
||||
buf.writeByte(')');
|
||||
}
|
||||
@ -4141,7 +4141,7 @@ string EXPtoString(EXP op)
|
||||
EXP.delegatePointer : "delegateptr",
|
||||
EXP.delegateFunctionPointer : "delegatefuncptr",
|
||||
EXP.remove : "remove",
|
||||
EXP.tuple : "tuple",
|
||||
EXP.tuple : "sequence",
|
||||
EXP.traits : "__traits",
|
||||
EXP.overloadSet : "__overloadset",
|
||||
EXP.void_ : "void",
|
||||
|
@ -582,7 +582,7 @@ extern(C++) Initializer initializerSemantic(Initializer init, Scope* sc, ref Typ
|
||||
|
||||
Initializer visitC(CInitializer ci)
|
||||
{
|
||||
//printf("CInitializer::semantic() (%s) %s\n", t.toChars(), ci.toChars());
|
||||
//printf("CInitializer::semantic() tx: %s t: %s ci: %s\n", (tx ? tx.toChars() : "".ptr), t.toChars(), ci.toChars());
|
||||
/* Rewrite CInitializer into ExpInitializer, ArrayInitializer, or StructInitializer
|
||||
*/
|
||||
t = t.toBasetype();
|
||||
@ -770,7 +770,6 @@ extern(C++) Initializer initializerSemantic(Initializer init, Scope* sc, ref Typ
|
||||
return err();
|
||||
}
|
||||
const nfields = sd.fields.length;
|
||||
|
||||
size_t fieldi = 0;
|
||||
|
||||
for (size_t index = 0; index < ci.initializerList.length; )
|
||||
@ -807,6 +806,12 @@ extern(C++) Initializer initializerSemantic(Initializer init, Scope* sc, ref Typ
|
||||
{
|
||||
if (fieldi == nfields)
|
||||
break;
|
||||
if (index == 0 && ci.initializerList.length == 1 && di.initializer.isCInitializer())
|
||||
{
|
||||
ci = di.initializer.isCInitializer();
|
||||
continue;
|
||||
}
|
||||
|
||||
VarDeclaration field;
|
||||
while (1) // skip field if it overlaps with previously seen fields
|
||||
{
|
||||
@ -954,10 +959,13 @@ extern(C++) Initializer initializerSemantic(Initializer init, Scope* sc, ref Typ
|
||||
return initializerSemantic(ai, sc, tx, needInterpret);
|
||||
}
|
||||
else if (ExpInitializer ei = isBraceExpression())
|
||||
{
|
||||
return visitExp(ei);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(0);
|
||||
error(ci.loc, "unrecognized C initializer `%s`", ci.toChars());
|
||||
return err();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@ import dmd.expression;
|
||||
* Perform the "inline copying" of a default argument for a function parameter.
|
||||
*
|
||||
* Todo:
|
||||
* The hack for bugzilla 4820 case is still questionable. Perhaps would have to
|
||||
* handle a delegate expression with 'null' context properly in front-end.
|
||||
* The hack for https://issues.dlang.org/show_bug.cgi?id=4820 case is still questionable.
|
||||
* Perhaps would have to handle a delegate expression with 'null' context properly in front-end.
|
||||
*/
|
||||
public Expression inlineCopy(Expression e, Scope* sc)
|
||||
{
|
||||
|
@ -2205,7 +2205,7 @@ class Lexer
|
||||
p++;
|
||||
if ((flags & f) && !err)
|
||||
{
|
||||
error("unrecognized token");
|
||||
error("repeated integer suffix `%c`", p[-1]);
|
||||
err = true;
|
||||
}
|
||||
flags = cast(FLAGS)(flags | f);
|
||||
|
@ -2054,7 +2054,7 @@ extern (C++) abstract class Type : ASTNode
|
||||
return Type.terror;
|
||||
|
||||
auto t = fd.type.nextOf();
|
||||
if (!t) // issue 14185
|
||||
if (!t) // https://issues.dlang.org/show_bug.cgi?id=14185
|
||||
return Type.terror;
|
||||
t = t.substWildTo(mod == 0 ? MODFlags.mutable : mod);
|
||||
return t;
|
||||
@ -4597,10 +4597,9 @@ extern (C++) final class TypeFunction : TypeNext
|
||||
// show qualification when toChars() is the same but types are different
|
||||
// https://issues.dlang.org/show_bug.cgi?id=19948
|
||||
// when comparing the type with strcmp, we need to drop the qualifier
|
||||
auto at = arg.type.mutableOf().toChars();
|
||||
bool qual = !arg.type.equals(par.type) && strcmp(at, par.type.mutableOf().toChars()) == 0;
|
||||
if (qual)
|
||||
at = arg.type.toPrettyChars(true);
|
||||
bool qual = !arg.type.mutableOf().equals(par.type.mutableOf()) &&
|
||||
strcmp(arg.type.mutableOf().toChars(), par.type.mutableOf().toChars()) == 0;
|
||||
auto at = qual ? arg.type.toPrettyChars(true) : arg.type.toChars();
|
||||
OutBuffer buf;
|
||||
// only mention rvalue if it's relevant
|
||||
const rv = !arg.isLvalue() && par.isReference();
|
||||
@ -4940,7 +4939,7 @@ extern (C++) final class TypeFunction : TypeNext
|
||||
}
|
||||
if (tb.ty == Ttuple)
|
||||
{
|
||||
error(loc, "functions cannot return a tuple");
|
||||
error(loc, "functions cannot return a sequence (use `std.typecons.Tuple`)");
|
||||
next = Type.terror;
|
||||
}
|
||||
if (!isref && (tb.ty == Tstruct || tb.ty == Tsarray))
|
||||
@ -5105,7 +5104,7 @@ extern (C++) final class TypeDelegate : TypeNext
|
||||
* This is a shell containing a TraitsExp that can be
|
||||
* either resolved to a type or to a symbol.
|
||||
*
|
||||
* The point is to allow AliasDeclarationY to use `__traits()`, see issue 7804.
|
||||
* The point is to allow AliasDeclarationY to use `__traits()`, see https://issues.dlang.org/show_bug.cgi?id=7804.
|
||||
*/
|
||||
extern (C++) final class TypeTraits : Type
|
||||
{
|
||||
@ -6218,7 +6217,7 @@ extern (C++) final class TypeTuple : Type
|
||||
{
|
||||
Expression e = (*exps)[i];
|
||||
if (e.type.ty == Ttuple)
|
||||
e.error("cannot form tuple of tuples");
|
||||
e.error("cannot form sequence of sequences");
|
||||
auto arg = new Parameter(STC.undefined_, e.type, null, null, null);
|
||||
(*arguments)[i] = arg;
|
||||
}
|
||||
@ -6273,7 +6272,7 @@ extern (C++) final class TypeTuple : Type
|
||||
|
||||
override const(char)* kind() const
|
||||
{
|
||||
return "tuple";
|
||||
return "sequence";
|
||||
}
|
||||
|
||||
override TypeTuple syntaxCopy()
|
||||
@ -7271,7 +7270,7 @@ private extern(D) bool isCopyConstructorCallable (StructDeclaration argStruct,
|
||||
{
|
||||
/* Although a copy constructor may exist, no suitable match was found.
|
||||
* i.e: `inout` constructor creates `const` object, not mutable.
|
||||
* Fallback to using the original generic error before bugzilla 22202.
|
||||
* Fallback to using the original generic error before https://issues.dlang.org/show_bug.cgi?id=22202.
|
||||
*/
|
||||
goto Lnocpctor;
|
||||
}
|
||||
|
@ -416,9 +416,11 @@ Expression op_overload(Expression e, Scope* sc, EXP* pop = null)
|
||||
* op(e1.aliasthis)
|
||||
*/
|
||||
//printf("att una %s e1 = %s\n", EXPtoString(op).ptr, this.e1.type.toChars());
|
||||
e.e1 = resolveAliasThis(sc, e.e1, true);
|
||||
if (e.e1)
|
||||
if (auto e1 = resolveAliasThis(sc, e.e1, true))
|
||||
{
|
||||
e.e1 = e1;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -1043,7 +1045,7 @@ Expression op_overload(Expression e, Scope* sc, EXP* pop = null)
|
||||
size_t dim = tup1.exps.length;
|
||||
if (dim != tup2.exps.length)
|
||||
{
|
||||
e.error("mismatched tuple lengths, `%d` and `%d`",
|
||||
e.error("mismatched sequence lengths, `%d` and `%d`",
|
||||
cast(int)dim, cast(int)tup2.exps.length);
|
||||
return ErrorExp.get();
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ private Expression fromConstInitializer(int result, Expression e1)
|
||||
{
|
||||
// If it is a comma expression involving a declaration, we mustn't
|
||||
// perform a copy -- we'd get two declarations of the same variable.
|
||||
// See bugzilla 4465.
|
||||
// See https://issues.dlang.org/show_bug.cgi?id=4465.
|
||||
if (e.op == EXP.comma && e.isCommaExp().e1.isDeclarationExp())
|
||||
e = e1;
|
||||
else if (e.type != e1.type && e1.type && e1.type.ty != Tident)
|
||||
|
@ -1155,6 +1155,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
|
||||
|
||||
case TOK.leftCurly:
|
||||
{
|
||||
const lcLoc = token.loc;
|
||||
const lookingForElseSave = lookingForElse;
|
||||
lookingForElse = Loc();
|
||||
|
||||
@ -1164,6 +1165,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
|
||||
{
|
||||
/* { */
|
||||
error("matching `}` expected, not `%s`", token.toChars());
|
||||
eSink.errorSupplemental(lcLoc, "unmatched `{`");
|
||||
}
|
||||
else
|
||||
nextToken();
|
||||
@ -1405,6 +1407,15 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Token* tk;
|
||||
if (skipAttributes(&token, &tk) && tk.ptr != token.ptr ||
|
||||
token.value == TOK.static_ || token.value == TOK.extern_)
|
||||
{
|
||||
error("`%s` token is not allowed in postfix position",
|
||||
Token.toChars(token.value));
|
||||
nextToken();
|
||||
continue;
|
||||
}
|
||||
return storageClass;
|
||||
}
|
||||
storageClass = appendStorageClass(storageClass, stc);
|
||||
@ -6006,6 +6017,7 @@ LagainStc:
|
||||
}
|
||||
case TOK.leftCurly:
|
||||
{
|
||||
const lcLoc = token.loc;
|
||||
const lookingForElseSave = lookingForElse;
|
||||
lookingForElse = Loc.initial;
|
||||
|
||||
@ -6028,7 +6040,14 @@ LagainStc:
|
||||
s = new AST.CompoundStatement(loc, statements);
|
||||
if (flags & (ParseStatementFlags.scope_ | ParseStatementFlags.curlyScope))
|
||||
s = new AST.ScopeStatement(loc, s, token.loc);
|
||||
check(TOK.rightCurly, "compound statement");
|
||||
if (token.value != TOK.rightCurly)
|
||||
{
|
||||
error(token.loc, "matching `}` expected following compound statement, not `%s`",
|
||||
token.toChars());
|
||||
eSink.errorSupplemental(lcLoc, "unmatched `{`");
|
||||
}
|
||||
else
|
||||
nextToken();
|
||||
lookingForElse = lookingForElseSave;
|
||||
break;
|
||||
}
|
||||
|
@ -251,6 +251,18 @@ public:
|
||||
length++;
|
||||
}
|
||||
|
||||
/// Insert 'count' copies of 'value' at 'index' position
|
||||
void insert(size_t index, size_t count, T value) pure nothrow
|
||||
{
|
||||
if (count == 0)
|
||||
return;
|
||||
reserve(count);
|
||||
if (length != index)
|
||||
memmove(data.ptr + index + count, data.ptr + index, (length - index) * T.sizeof);
|
||||
data[index .. index + count] = value;
|
||||
length += count;
|
||||
}
|
||||
|
||||
void setDim(size_t newdim) pure nothrow
|
||||
{
|
||||
if (length < newdim)
|
||||
@ -458,6 +470,12 @@ unittest
|
||||
arrayA.insert(0, [7, 8]);
|
||||
arrayA.insert(arrayA.length, [0, 9]);
|
||||
assert(arrayA[] == [7, 8, 5, 1, 2, 6, 0, 9]);
|
||||
arrayA.insert(4, 3, 8);
|
||||
assert(arrayA[] == [7, 8, 5, 1, 8, 8, 8, 2, 6, 0, 9]);
|
||||
arrayA.insert(0, 3, 8);
|
||||
assert(arrayA[] == [8, 8, 8, 7, 8, 5, 1, 8, 8, 8, 2, 6, 0, 9]);
|
||||
arrayA.insert(arrayA.length, 3, 8);
|
||||
assert(arrayA[] == [8, 8, 8, 7, 8, 5, 1, 8, 8, 8, 2, 6, 0, 9, 8, 8, 8]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -657,6 +657,13 @@ private extern(C++) final class Semantic2Visitor : Visitor
|
||||
{
|
||||
foreach (base; cd.interfaces)
|
||||
{
|
||||
// https://issues.dlang.org/show_bug.cgi?id=22729
|
||||
// interfaces that have errors or that
|
||||
// inherit from interfaces that have errors
|
||||
// might have an uninitialized vtable
|
||||
if (!base.sym.vtbl.length)
|
||||
continue;
|
||||
|
||||
// first entry is ClassInfo reference
|
||||
auto methods = base.sym.vtbl[base.sym.vtblOffset .. $];
|
||||
|
||||
|
@ -1367,6 +1367,8 @@ private extern(C++) final class Semantic3Visitor : Visitor
|
||||
if (isCppNonMappableType(f.next.toBasetype()))
|
||||
{
|
||||
funcdecl.error("cannot return type `%s` because its linkage is `extern(C++)`", f.next.toChars());
|
||||
if (f.next.isTypeDArray())
|
||||
errorSupplemental(funcdecl.loc, "slices are specific to D and do not have a counterpart representation in C++", f.next.toChars());
|
||||
funcdecl.errors = true;
|
||||
}
|
||||
foreach (i, param; f.parameterList)
|
||||
@ -1605,7 +1607,7 @@ private struct FuncDeclSem3
|
||||
sc = s;
|
||||
}
|
||||
|
||||
/* Checks that the overriden functions (if any) have in contracts if
|
||||
/* Checks that the overridden functions (if any) have in contracts if
|
||||
* funcdecl has an in contract.
|
||||
*/
|
||||
void checkInContractOverrides()
|
||||
|
@ -257,8 +257,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
|
||||
continue;
|
||||
}
|
||||
|
||||
Statements* flt = s.flatten(sc);
|
||||
if (flt)
|
||||
if (auto flt = s.flatten(sc))
|
||||
{
|
||||
cs.statements.remove(i);
|
||||
cs.statements.insert(i, flt);
|
||||
@ -279,6 +278,24 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
|
||||
++i;
|
||||
continue; // look for errors in rest of statements
|
||||
}
|
||||
|
||||
// expand tuple variables in order to attach destruction/exception logic
|
||||
if (auto es = s.isExpStatement())
|
||||
{
|
||||
if (es.exp && es.exp.isDeclarationExp())
|
||||
{
|
||||
auto de = es.exp.isDeclarationExp();
|
||||
auto vd = de.declaration.isVarDeclaration();
|
||||
if (vd && vd.aliasTuple && vd.aliasTuple.objects.length)
|
||||
{
|
||||
auto j = i;
|
||||
cs.statements.insert(i, vd.aliasTuple.objects.length - 1, null);
|
||||
vd.aliasTuple.foreachVar((v) { (*cs.statements)[j++] = toStatement(v); });
|
||||
s = (*cs.statements)[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Statement sentry;
|
||||
Statement sexception;
|
||||
Statement sfinally;
|
||||
@ -384,12 +401,11 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
|
||||
|
||||
/* Flatten them in place
|
||||
*/
|
||||
void flatten(Statements* statements)
|
||||
void flattenStatements(ref Statements statements)
|
||||
{
|
||||
for (size_t i = 0; i < statements.length;)
|
||||
{
|
||||
Statement s = (*statements)[i];
|
||||
if (s)
|
||||
if (auto s = statements[i])
|
||||
{
|
||||
if (auto flt = s.flatten(sc))
|
||||
{
|
||||
@ -406,7 +422,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
|
||||
* 'semantic' may return another CompoundStatement
|
||||
* (eg. CaseRangeStatement), so flatten it here.
|
||||
*/
|
||||
flatten(cs.statements);
|
||||
flattenStatements(*cs.statements);
|
||||
|
||||
foreach (s; *cs.statements)
|
||||
{
|
||||
@ -4298,7 +4314,7 @@ public auto makeTupleForeach(Scope* sc, bool isStatic, bool isDecl, ForeachState
|
||||
const bool skipCheck = isStatic && needExpansion;
|
||||
if (!skipCheck && (dim < 1 || dim > 2))
|
||||
{
|
||||
fs.error("only one (value) or two (key,value) arguments for tuple `foreach`");
|
||||
fs.error("only one (value) or two (key,value) arguments allowed for sequence `foreach`");
|
||||
return returnEarly();
|
||||
}
|
||||
|
||||
|
@ -1556,7 +1556,9 @@ Expression semanticTraits(TraitsExp e, Scope* sc)
|
||||
if (auto imp = s.isImport())
|
||||
{
|
||||
// https://issues.dlang.org/show_bug.cgi?id=9692
|
||||
s = imp.mod;
|
||||
// https://issues.dlang.org/show_bug.cgi?id=20008
|
||||
if (imp.pkg)
|
||||
s = imp.pkg;
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=16044
|
||||
@ -2116,7 +2118,7 @@ private bool isSame(RootObject o1, RootObject o2, Scope* sc)
|
||||
return true;
|
||||
}
|
||||
|
||||
// issue 12001, allow isSame, <BasicType>, <BasicType>
|
||||
// https://issues.dlang.org/show_bug.cgi?id=12001, allow isSame, <BasicType>, <BasicType>
|
||||
Type t1 = isType(o1);
|
||||
Type t2 = isType(o2);
|
||||
if (t1 && t2 && t1.equals(t2))
|
||||
|
@ -162,14 +162,14 @@ package mixin template ParseVisitMethods(AST)
|
||||
}
|
||||
|
||||
override void visit(AST.StaticForeachStatement s)
|
||||
{
|
||||
{
|
||||
// printf("Visiting StaticForeachStatement\n");
|
||||
if (s.sfe.aggrfe)
|
||||
if (s.sfe.aggrfe)
|
||||
s.sfe.aggrfe.accept(this);
|
||||
|
||||
if (s.sfe.rangefe)
|
||||
if (s.sfe.rangefe)
|
||||
s.sfe.rangefe.accept(this);
|
||||
}
|
||||
}
|
||||
|
||||
override void visit(AST.IfStatement s)
|
||||
{
|
||||
|
@ -121,7 +121,7 @@ private void resolveTupleIndex(const ref Loc loc, Scope* sc, Dsymbol s, out Expr
|
||||
const(uinteger_t) d = eindex.toUInteger();
|
||||
if (d >= tup.objects.length)
|
||||
{
|
||||
.error(loc, "tuple index `%llu` out of bounds `[0 .. %llu]`", d, cast(ulong)tup.objects.length);
|
||||
.error(loc, "sequence index `%llu` out of bounds `[0 .. %llu]`", d, cast(ulong)tup.objects.length);
|
||||
pt = Type.terror;
|
||||
return;
|
||||
}
|
||||
@ -525,7 +525,7 @@ extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
|
||||
uinteger_t d = mtype.dim.toUInteger();
|
||||
if (d >= tup.objects.length)
|
||||
{
|
||||
.error(loc, "tuple index `%llu` out of bounds `[0 .. %llu]`", cast(ulong)d, cast(ulong)tup.objects.length);
|
||||
.error(loc, "sequence index `%llu` out of bounds `[0 .. %llu]`", cast(ulong)d, cast(ulong)tup.objects.length);
|
||||
return error();
|
||||
}
|
||||
|
||||
@ -621,7 +621,7 @@ extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
|
||||
uinteger_t d = mtype.dim.toUInteger();
|
||||
if (d >= tt.arguments.length)
|
||||
{
|
||||
.error(loc, "tuple index `%llu` out of bounds `[0 .. %llu]`", cast(ulong)d, cast(ulong)tt.arguments.length);
|
||||
.error(loc, "sequence index `%llu` out of bounds `[0 .. %llu]`", cast(ulong)d, cast(ulong)tt.arguments.length);
|
||||
return error();
|
||||
}
|
||||
Type telem = (*tt.arguments)[cast(size_t)d].type;
|
||||
@ -1684,7 +1684,7 @@ extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
|
||||
Type tbn = tn.toBasetype();
|
||||
if (tbn.ty != Ttuple)
|
||||
{
|
||||
.error(loc, "can only slice tuple types, not `%s`", tbn.toChars());
|
||||
.error(loc, "can only slice type sequences, not `%s`", tbn.toChars());
|
||||
return error();
|
||||
}
|
||||
TypeTuple tt = cast(TypeTuple)tbn;
|
||||
@ -2436,7 +2436,7 @@ Expression getProperty(Type t, Scope* scope_, const ref Loc loc, Identifier iden
|
||||
}
|
||||
else
|
||||
{
|
||||
error(loc, "no property `%s` for tuple `%s`", ident.toChars(), mt.toChars());
|
||||
error(loc, "no property `%s` for sequence `%s`", ident.toChars(), mt.toChars());
|
||||
e = ErrorExp.get();
|
||||
}
|
||||
return e;
|
||||
@ -2563,7 +2563,7 @@ void resolve(Type mt, const ref Loc loc, Scope* sc, out Expression pe, out Type
|
||||
const d = mt.dim.toUInteger();
|
||||
if (d >= tup.objects.length)
|
||||
{
|
||||
error(loc, "tuple index `%llu` out of bounds `[0 .. %llu]`", d, cast(ulong) tup.objects.length);
|
||||
error(loc, "sequence index `%llu` out of bounds `[0 .. %llu]`", d, cast(ulong) tup.objects.length);
|
||||
return returnError();
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// issue 20938 - Cannot create const arrays mixing immutable and mutable structs with indirections
|
||||
// https://issues.dlang.org/show_bug.cgi?id=20938
|
||||
// Cannot create const arrays mixing immutable and mutable structs with indirections
|
||||
struct S { int[] a; }
|
||||
enum A { a }
|
||||
enum B { b }
|
||||
|
@ -117,18 +117,18 @@ static assert(is( X!( Ei, Ei ) == Ei ));
|
||||
static assert(is( X!( Ei, const(Ei) ) == const(Ei) ));
|
||||
static assert(is( X!( Ei, immutable(Ei) ) == const(Ei) ));
|
||||
static assert(is( X!( Eb, Eb ) == Eb ));
|
||||
static assert(is( X!( Eb, const(Eb) ) == int ));
|
||||
static assert(is( X!( Eb, immutable(Eb) ) == int ));
|
||||
static assert(is( X!( Eb, const(Eb) ) == const(Eb) ));
|
||||
static assert(is( X!( Eb, immutable(Eb) ) == const(Eb) ));
|
||||
static assert(is( X!( Ei, Eb ) == int ));
|
||||
static assert(is( X!( Ei, const(Eb) ) == int ));
|
||||
static assert(is( X!( Ei, immutable(Eb) ) == int ));
|
||||
|
||||
static assert(is( X!( Ec, Ec ) == Ec ));
|
||||
static assert(is( X!( Ec, const(Ec) ) == const(char) ));
|
||||
static assert(is( X!( Ec, immutable(Ec) ) == const(char) ));
|
||||
static assert(is( X!( Ec, const(Ec) ) == const(Ec) ));
|
||||
static assert(is( X!( Ec, immutable(Ec) ) == const(Ec) ));
|
||||
static assert(is( X!( Ew, Ew ) == Ew ));
|
||||
static assert(is( X!( Ew, const(Ew) ) == const(wchar) ));
|
||||
static assert(is( X!( Ew, immutable(Ew) ) == const(wchar) ));
|
||||
static assert(is( X!( Ew, const(Ew) ) == const(Ew) ));
|
||||
static assert(is( X!( Ew, immutable(Ew) ) == const(Ew) ));
|
||||
static assert(is( X!( Ew, Ec ) == dchar ));
|
||||
static assert(is( X!( Ew, const(Ec) ) == dchar ));
|
||||
static assert(is( X!( Ew, immutable(Ec) ) == dchar ));
|
||||
|
@ -0,0 +1,9 @@
|
||||
module pkg20008;
|
||||
|
||||
import pkg20008.submod;
|
||||
|
||||
enum T2 { y }
|
||||
enum T3 { z }
|
||||
|
||||
static assert([__traits(allMembers, pkg20008)] == ["object", "pkg20008", "T2", "T3"]);
|
||||
static assert([__traits(allMembers, pkg20008.submod)] == ["object", "T1"]);
|
@ -0,0 +1,2 @@
|
||||
module pkg20008.submod;
|
||||
enum T1 { x }
|
@ -0,0 +1,7 @@
|
||||
module pkg20008.subpkg;
|
||||
|
||||
import pkg20008.subpkg.subsubmod;
|
||||
|
||||
enum T9 { x }
|
||||
|
||||
static assert([__traits(allMembers, pkg20008.subpkg)] == ["object", "pkg20008", "T9"]);
|
@ -0,0 +1,9 @@
|
||||
module pkg20008.subpkg.subsubmod;
|
||||
|
||||
import pkg20008.subpkg;
|
||||
import pkg20008.subpkg.subsubmod;
|
||||
|
||||
enum T8 { x }
|
||||
|
||||
static assert([__traits(allMembers, pkg20008.subpkg)] == ["object", "pkg20008", "T9"]);
|
||||
static assert([__traits(allMembers, pkg20008.subpkg.subsubmod)] == ["object", "pkg20008", "T8"]);
|
@ -1,2 +1,2 @@
|
||||
module imports.test9692b;
|
||||
int j;
|
||||
int k;
|
||||
|
10
gcc/testsuite/gdc.test/compilable/issue24018.d
Normal file
10
gcc/testsuite/gdc.test/compilable/issue24018.d
Normal file
@ -0,0 +1,10 @@
|
||||
struct S
|
||||
{
|
||||
@disable this();
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
S[] s;
|
||||
s = s ~ s;
|
||||
}
|
@ -2,59 +2,59 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
100 tuple()
|
||||
101 tuple("return", "ref")
|
||||
102 tuple("ref")
|
||||
103 tuple()
|
||||
104 tuple("ref")
|
||||
105 tuple()
|
||||
106 tuple()
|
||||
107 tuple("ref")
|
||||
108 tuple("ref")
|
||||
109 tuple("ref")
|
||||
110 tuple("ref")
|
||||
111 tuple()
|
||||
112 tuple("ref")
|
||||
113 tuple("ref")
|
||||
114 tuple("ref")
|
||||
115 tuple("ref")
|
||||
116 tuple()
|
||||
117 tuple("ref")
|
||||
118 tuple("ref")
|
||||
119 tuple()
|
||||
120 tuple("ref")
|
||||
121 tuple()
|
||||
122 tuple("ref")
|
||||
123 tuple("in")
|
||||
124 tuple("in")
|
||||
m tuple("ref")
|
||||
m-mixin tuple("ref")
|
||||
m tuple("ref")
|
||||
m-mixin tuple("ref")
|
||||
m tuple("ref")
|
||||
m-mixin tuple("ref")
|
||||
m tuple("return", "ref")
|
||||
m-mixin tuple("return", "ref")
|
||||
m tuple("ref")
|
||||
m-mixin tuple("ref")
|
||||
m tuple("ref")
|
||||
m-mixin tuple("ref")
|
||||
m tuple()
|
||||
m-mixin tuple()
|
||||
m tuple("ref")
|
||||
m-mixin tuple("ref")
|
||||
m tuple("ref")
|
||||
m-mixin tuple("ref")
|
||||
m tuple("ref")
|
||||
m-mixin tuple("ref")
|
||||
m tuple("ref")
|
||||
m-mixin tuple("ref")
|
||||
m tuple("ref")
|
||||
m-mixin tuple("ref")
|
||||
m tuple("ref")
|
||||
m-mixin tuple("ref")
|
||||
m tuple("in")
|
||||
m-mixin tuple("in")
|
||||
100 AliasSeq!()
|
||||
101 AliasSeq!("return", "ref")
|
||||
102 AliasSeq!("ref")
|
||||
103 AliasSeq!()
|
||||
104 AliasSeq!("ref")
|
||||
105 AliasSeq!()
|
||||
106 AliasSeq!()
|
||||
107 AliasSeq!("ref")
|
||||
108 AliasSeq!("ref")
|
||||
109 AliasSeq!("ref")
|
||||
110 AliasSeq!("ref")
|
||||
111 AliasSeq!()
|
||||
112 AliasSeq!("ref")
|
||||
113 AliasSeq!("ref")
|
||||
114 AliasSeq!("ref")
|
||||
115 AliasSeq!("ref")
|
||||
116 AliasSeq!()
|
||||
117 AliasSeq!("ref")
|
||||
118 AliasSeq!("ref")
|
||||
119 AliasSeq!()
|
||||
120 AliasSeq!("ref")
|
||||
121 AliasSeq!()
|
||||
122 AliasSeq!("ref")
|
||||
123 AliasSeq!("in")
|
||||
124 AliasSeq!("in")
|
||||
m AliasSeq!("ref")
|
||||
m-mixin AliasSeq!("ref")
|
||||
m AliasSeq!("ref")
|
||||
m-mixin AliasSeq!("ref")
|
||||
m AliasSeq!("ref")
|
||||
m-mixin AliasSeq!("ref")
|
||||
m AliasSeq!("return", "ref")
|
||||
m-mixin AliasSeq!("return", "ref")
|
||||
m AliasSeq!("ref")
|
||||
m-mixin AliasSeq!("ref")
|
||||
m AliasSeq!("ref")
|
||||
m-mixin AliasSeq!("ref")
|
||||
m AliasSeq!()
|
||||
m-mixin AliasSeq!()
|
||||
m AliasSeq!("ref")
|
||||
m-mixin AliasSeq!("ref")
|
||||
m AliasSeq!("ref")
|
||||
m-mixin AliasSeq!("ref")
|
||||
m AliasSeq!("ref")
|
||||
m-mixin AliasSeq!("ref")
|
||||
m AliasSeq!("ref")
|
||||
m-mixin AliasSeq!("ref")
|
||||
m AliasSeq!("ref")
|
||||
m-mixin AliasSeq!("ref")
|
||||
m AliasSeq!("ref")
|
||||
m-mixin AliasSeq!("ref")
|
||||
m AliasSeq!("in")
|
||||
m-mixin AliasSeq!("in")
|
||||
---
|
||||
*/
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
tuple("id", "toString", "toHash", "opCmp", "opEquals", "Monitor", "factory")
|
||||
AliasSeq!("id", "toString", "toHash", "opCmp", "opEquals", "Monitor", "factory")
|
||||
genProps
|
||||
---
|
||||
*/
|
||||
|
@ -39,7 +39,7 @@ void test16635_1()
|
||||
Vector2 b = Vector2(3, 4);
|
||||
|
||||
// this line causes application to run infinitely
|
||||
// Already fixed. It was issue 16621
|
||||
// Already fixed. It was https://issues.dlang.org/show_bug.cgi?id=16621
|
||||
Vector2 c = a + b;
|
||||
|
||||
// OK <- this line seg faults without the above line
|
||||
|
@ -13,4 +13,4 @@ Tuple!T tuple(T...)(T args)
|
||||
|
||||
enum foo = tuple(1, 2).expand;
|
||||
static assert(typeof(foo).stringof == "(int, int)");
|
||||
static assert(foo.stringof == "tuple(1, 2)");
|
||||
static assert(foo.stringof == "AliasSeq!(1, 2)");
|
||||
|
@ -28,5 +28,5 @@ interface ConnectionStream : Stream
|
||||
void close();
|
||||
}
|
||||
|
||||
static assert(__traits(getOverloads, ConnectionStream, "connected").stringof == "tuple(connected)");
|
||||
static assert(__traits(getOverloads, ConnectionStream, "close").stringof == "tuple(close)");
|
||||
static assert(__traits(getOverloads, ConnectionStream, "connected").stringof == "AliasSeq!(connected)");
|
||||
static assert(__traits(getOverloads, ConnectionStream, "close").stringof == "AliasSeq!(close)");
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* TEST_OUTPUT:
|
||||
---
|
||||
tuple((Attrib))
|
||||
AliasSeq!((Attrib))
|
||||
---
|
||||
*/
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
tuple((A), (B))
|
||||
tuple((A), (B), 0)
|
||||
tuple((A), (B), (A))
|
||||
tuple((A), (B), (A), (B))
|
||||
tuple((A), (B), (A), (B))
|
||||
tuple((A), (B), (A), (B), (A), (B), (A), (B))
|
||||
tuple((Attr))
|
||||
AliasSeq!((A), (B))
|
||||
AliasSeq!((A), (B), 0)
|
||||
AliasSeq!((A), (B), (A))
|
||||
AliasSeq!((A), (B), (A), (B))
|
||||
AliasSeq!((A), (B), (A), (B))
|
||||
AliasSeq!((A), (B), (A), (B), (A), (B), (A), (B))
|
||||
AliasSeq!((Attr))
|
||||
---
|
||||
*/
|
||||
|
||||
|
6
gcc/testsuite/gdc.test/compilable/test20008.d
Normal file
6
gcc/testsuite/gdc.test/compilable/test20008.d
Normal file
@ -0,0 +1,6 @@
|
||||
/*
|
||||
REQUIRED_ARGS: -Icompilable/imports -c -o-
|
||||
EXTRA_FILES: imports/pkg20008/package.d imports/pkg20008/submod.d imports/pkg20008/subpkg/package.d imports/pkg20008/subpkg/subsubmod.d
|
||||
*/
|
||||
import pkg20008;
|
||||
import pkg20008.subpkg;
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
tuple(func)
|
||||
AliasSeq!(func)
|
||||
---
|
||||
*/
|
||||
// https://issues.dlang.org/show_bug.cgi?id=21282
|
||||
|
@ -2,8 +2,8 @@
|
||||
REQUIRED_ARGS: -unittest
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
tuple(__unittest_L14_C5_1, __unittest_L14_C5_2)
|
||||
tuple(__unittest_L14_C5_2)
|
||||
AliasSeq!(__unittest_L14_C5_1, __unittest_L14_C5_2)
|
||||
AliasSeq!(__unittest_L14_C5_2)
|
||||
---
|
||||
*/
|
||||
// https://issues.dlang.org/show_bug.cgi?id=21330
|
||||
|
11
gcc/testsuite/gdc.test/compilable/test23965.d
Normal file
11
gcc/testsuite/gdc.test/compilable/test23965.d
Normal file
@ -0,0 +1,11 @@
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23965
|
||||
// REQUIRED_ARGS: -de
|
||||
deprecated:
|
||||
|
||||
struct S {}
|
||||
|
||||
void fun()
|
||||
{
|
||||
S[] arr;
|
||||
arr ~= S();
|
||||
}
|
30
gcc/testsuite/gdc.test/compilable/test23978.d
Normal file
30
gcc/testsuite/gdc.test/compilable/test23978.d
Normal file
@ -0,0 +1,30 @@
|
||||
// REQUIRED_ARGS: -preview=dip1021 -lowmem
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23978
|
||||
|
||||
// Note: this is a memory corruption bug.
|
||||
// Memory returned by `GC.realloc` retains references to old memory in it,
|
||||
// mostly because of the smallarray optimization for `Array(T)`.
|
||||
// If this fails again, it might not be consistent, so try running it multiple times.
|
||||
|
||||
class LUBench { }
|
||||
void lup(ulong , ulong , int , int = 1)
|
||||
{
|
||||
new LUBench;
|
||||
}
|
||||
void lup_3200(ulong iters, ulong flops)
|
||||
{
|
||||
lup(iters, flops, 3200);
|
||||
}
|
||||
void raytrace()
|
||||
{
|
||||
struct V
|
||||
{
|
||||
float x, y, z;
|
||||
auto normalize() { }
|
||||
struct Tid { }
|
||||
auto spawnLinked() { }
|
||||
string[] namesByTid;
|
||||
class MessageBox { }
|
||||
auto cross() { }
|
||||
}
|
||||
}
|
17
gcc/testsuite/gdc.test/compilable/test23979.d
Normal file
17
gcc/testsuite/gdc.test/compilable/test23979.d
Normal file
@ -0,0 +1,17 @@
|
||||
// REQUIRED_ARGS: -o-
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23979
|
||||
// Issue 23979 - ICE on failed alias this attempt on pointer expression
|
||||
|
||||
class A {}
|
||||
|
||||
void h()
|
||||
{
|
||||
const auto classPtr = SPtr.init;
|
||||
assert(!__traits(compiles, *classPtr));
|
||||
}
|
||||
|
||||
struct SPtr
|
||||
{
|
||||
A ptr() { return A.init; }
|
||||
alias ptr this;
|
||||
}
|
11
gcc/testsuite/gdc.test/compilable/test23986.d
Normal file
11
gcc/testsuite/gdc.test/compilable/test23986.d
Normal file
@ -0,0 +1,11 @@
|
||||
// REQUIRED_ARGS: -preview=dip1021 -o-
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23986
|
||||
// dip1021 asserts on `typeof(null)` parameter
|
||||
@safe:
|
||||
|
||||
void f(typeof(null) obj, int* x) {}
|
||||
|
||||
void g()
|
||||
{
|
||||
f(null, null);
|
||||
}
|
43
gcc/testsuite/gdc.test/compilable/test24013.d
Normal file
43
gcc/testsuite/gdc.test/compilable/test24013.d
Normal file
@ -0,0 +1,43 @@
|
||||
// https://issues.dlang.org/show_bug.cgi?id=24013
|
||||
|
||||
struct PropDescriptor(T)
|
||||
{
|
||||
void define(T delegate() aGetter, string aName) {}
|
||||
}
|
||||
|
||||
enum Get;
|
||||
|
||||
mixin template PropertyPublisherImpl()
|
||||
{
|
||||
void collectPublicationsFromPairs(T)()
|
||||
{
|
||||
foreach (member; __traits(derivedMembers, T))
|
||||
foreach (overload; __traits(getOverloads, T, member))
|
||||
{
|
||||
alias Attributes = __traits(getAttributes, overload);
|
||||
static if (Attributes.length != 0)
|
||||
{
|
||||
auto descriptor = new PropDescriptor!size_t;
|
||||
auto dg = &overload;
|
||||
descriptor.define(dg, member);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
class Bar
|
||||
{
|
||||
size_t _field;
|
||||
mixin PropertyPublisherImpl;
|
||||
this()
|
||||
{
|
||||
collectPublicationsFromPairs!Bar;
|
||||
}
|
||||
@Get size_t field()
|
||||
{
|
||||
return _field;
|
||||
}
|
||||
}
|
||||
}
|
11
gcc/testsuite/gdc.test/compilable/test24017.d
Normal file
11
gcc/testsuite/gdc.test/compilable/test24017.d
Normal file
@ -0,0 +1,11 @@
|
||||
// https://issues.dlang.org/show_bug.cgi?id=24017
|
||||
|
||||
// REQUIRED_ARGS: -debug
|
||||
|
||||
void writeln(string) {}
|
||||
|
||||
void main() nothrow
|
||||
{
|
||||
debug writeln("Hello");
|
||||
debug "Hello".writeln;
|
||||
}
|
@ -4,5 +4,5 @@ module test9692;
|
||||
import test9692a;
|
||||
import imports.test9692b;
|
||||
|
||||
enum x = [__traits(allMembers, imports.test9692b)]; // ok
|
||||
enum y = [__traits(allMembers, test9692a)]; // ng: should work
|
||||
static assert([__traits(allMembers, imports.test9692b)] == ["object", "k"]); // ok
|
||||
static assert([__traits(allMembers, test9692a)] == ["object", "j"]); // ng: should work
|
||||
|
@ -171,9 +171,9 @@ template map7017(fun...) if (fun.length >= 1)
|
||||
auto map7017()
|
||||
{
|
||||
struct Result {
|
||||
this(int dummy){} // impure member function -> inferred to pure by fixing issue 10329
|
||||
this(int dummy){} // impure member function -> inferred to pure by fixing https://issues.dlang.org/show_bug.cgi?id=10329
|
||||
}
|
||||
return Result(0); // impure call -> inferred to pure by fixing issue 10329
|
||||
return Result(0); // impure call -> inferred to pure by fixing https://issues.dlang.org/show_bug.cgi?id=10329
|
||||
}
|
||||
}
|
||||
|
||||
@ -588,7 +588,7 @@ auto fb10148(T)()
|
||||
static assert(is(typeof(&fc) == void delegate()));
|
||||
fa10148();
|
||||
}
|
||||
// [1] this is now inferred to @safe by implementing issue 7511
|
||||
// [1] this is now inferred to @safe by implementing https://issues.dlang.org/show_bug.cgi?id=7511
|
||||
this(S a) {}
|
||||
}
|
||||
|
||||
|
16
gcc/testsuite/gdc.test/fail_compilation/callconst.d
Normal file
16
gcc/testsuite/gdc.test/fail_compilation/callconst.d
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/callconst.d(13): Error: function `callconst.func(ref X)` is not callable using argument types `(const(X))`
|
||||
fail_compilation/callconst.d(13): cannot pass argument `x` of type `const(X)` to parameter `ref X`
|
||||
---
|
||||
*/
|
||||
struct X {}
|
||||
|
||||
void main()
|
||||
{
|
||||
auto x = const X();
|
||||
func(x);
|
||||
}
|
||||
|
||||
void func(ref X);
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/casttuple.d(104): Error: cannot cast `__tup1_field_0` of type `int` to tuple type `(string)`
|
||||
fail_compilation/casttuple.d(107): Error: cannot cast `tuple(__tup2_field_0, __tup2_field_1)` of type `(int, int)` to tuple type `(string, string)`
|
||||
fail_compilation/casttuple.d(111): Error: cannot cast `tuple(foo, 123)` of type `(int, int)` to tuple type `(string, string)`
|
||||
fail_compilation/casttuple.d(104): Error: cannot cast `__tup1_field_0` of type `int` to type sequence `(string)`
|
||||
fail_compilation/casttuple.d(107): Error: cannot cast `AliasSeq!(__tup2_field_0, __tup2_field_1)` of type `(int, int)` to type sequence `(string, string)`
|
||||
fail_compilation/casttuple.d(111): Error: cannot cast `AliasSeq!(foo, 123)` of type `(int, int)` to type sequence `(string, string)`
|
||||
---
|
||||
*/
|
||||
|
||||
|
@ -3,7 +3,7 @@ TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/cppmangle.d(11): Error: expected valid identifier for C++ namespace but got ``
|
||||
fail_compilation/cppmangle.d(15): Error: expected valid identifier for C++ namespace but got `0num`
|
||||
fail_compilation/cppmangle.d(19): Error: compile time string constant (or tuple) expected, not `2`
|
||||
fail_compilation/cppmangle.d(19): Error: compile time string constant (or sequence) expected, not `2`
|
||||
fail_compilation/cppmangle.d(23): Error: expected valid identifier for C++ namespace but got `invalid@namespace`
|
||||
---
|
||||
*/
|
||||
|
@ -2,7 +2,7 @@
|
||||
REQUIRED_ARGS: -checkaction=context
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/dassert.d(14): Error: expression `tuple(0, 0)` of type `(int, int)` does not have a boolean value
|
||||
fail_compilation/dassert.d(14): Error: expression `AliasSeq!(0, 0)` of type `(int, int)` does not have a boolean value
|
||||
fail_compilation/dassert.d(21): Error: assignment cannot be used as a condition, perhaps `==` was meant?
|
||||
fail_compilation/dassert.d(29): Error: assignment cannot be used as a condition, perhaps `==` was meant?
|
||||
fail_compilation/dassert.d(40): Error: expression `issue()` of type `void` does not have a boolean value
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/diag13884.d(14): Error: functions cannot return a tuple
|
||||
fail_compilation/diag13884.d(14): Error: functions cannot return a sequence (use `std.typecons.Tuple`)
|
||||
fail_compilation/diag13884.d(21): instantiated from here: `MapResult!((t) => t.tupleof, Foo[])`
|
||||
fail_compilation/diag13884.d(14): instantiated from here: `map!(Foo[])`
|
||||
---
|
||||
|
@ -8,7 +8,7 @@ fail_compilation/diag14876.d(20): Deprecation: class `diag14876.Dep` is deprecat
|
||||
fail_compilation/diag14876.d(21): Deprecation: class `diag14876.Dep` is deprecated
|
||||
fail_compilation/diag14876.d(22): Deprecation: class `diag14876.Dep` is deprecated
|
||||
fail_compilation/diag14876.d(23): Deprecation: class `diag14876.Dep` is deprecated
|
||||
fail_compilation/diag14876.d(23): Error: can only slice tuple types, not `diag14876.Dep`
|
||||
fail_compilation/diag14876.d(23): Error: can only slice type sequences, not `diag14876.Dep`
|
||||
---
|
||||
*/
|
||||
|
||||
|
@ -30,7 +30,7 @@ struct HasDtor
|
||||
~this() {}
|
||||
}
|
||||
|
||||
// The user-defined dtor is overriden by a generated dtor calling both
|
||||
// The user-defined dtor is overridden by a generated dtor calling both
|
||||
// - HasDtor.~this
|
||||
// - Strict.~this
|
||||
struct Strict
|
||||
|
@ -1,12 +1,13 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/e15876_1.d(16): Error: valid scope identifiers are `exit`, `failure`, or `success`, not `x`
|
||||
fail_compilation/e15876_1.d(17): Error: found `End of File` when expecting `)`
|
||||
fail_compilation/e15876_1.d(17): Error: found `End of File` instead of statement
|
||||
fail_compilation/e15876_1.d(17): Error: found `End of File` when expecting `}` following compound statement
|
||||
fail_compilation/e15876_1.d(17): Error: found `End of File` when expecting `]`
|
||||
fail_compilation/e15876_1.d(17): Error: no identifier for declarator `o[()
|
||||
fail_compilation/e15876_1.d(17): Error: valid scope identifiers are `exit`, `failure`, or `success`, not `x`
|
||||
fail_compilation/e15876_1.d(18): Error: found `End of File` when expecting `)`
|
||||
fail_compilation/e15876_1.d(18): Error: found `End of File` instead of statement
|
||||
fail_compilation/e15876_1.d(18): Error: matching `}` expected following compound statement, not `End of File`
|
||||
fail_compilation/e15876_1.d(17): unmatched `{`
|
||||
fail_compilation/e15876_1.d(18): Error: found `End of File` when expecting `]`
|
||||
fail_compilation/e15876_1.d(18): Error: no identifier for declarator `o[()
|
||||
{
|
||||
scope(exit) __error__
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/e15876_2.d(15): Error: identifier expected following `template`
|
||||
fail_compilation/e15876_2.d(15): Error: found `End of File` when expecting `}` following compound statement
|
||||
fail_compilation/e15876_2.d(15): Error: found `End of File` when expecting `]`
|
||||
fail_compilation/e15876_2.d(15): Error: no identifier for declarator `o[()
|
||||
fail_compilation/e15876_2.d(16): Error: identifier expected following `template`
|
||||
fail_compilation/e15876_2.d(16): Error: matching `}` expected following compound statement, not `End of File`
|
||||
fail_compilation/e15876_2.d(15): unmatched `{`
|
||||
fail_compilation/e15876_2.d(16): Error: found `End of File` when expecting `]`
|
||||
fail_compilation/e15876_2.d(16): Error: no identifier for declarator `o[()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
@ -1,18 +1,19 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/e15876_3.d(27): Error: unexpected `(` in declarator
|
||||
fail_compilation/e15876_3.d(27): Error: basic type expected, not `=`
|
||||
fail_compilation/e15876_3.d(28): Error: found `End of File` when expecting `(`
|
||||
fail_compilation/e15876_3.d(28): Error: found `End of File` instead of statement
|
||||
fail_compilation/e15876_3.d(28): Error: expression expected, not `End of File`
|
||||
fail_compilation/e15876_3.d(28): Error: found `End of File` when expecting `;` following `for` condition
|
||||
fail_compilation/e15876_3.d(28): Error: expression expected, not `End of File`
|
||||
fail_compilation/e15876_3.d(28): Error: found `End of File` when expecting `)`
|
||||
fail_compilation/e15876_3.d(28): Error: found `End of File` instead of statement
|
||||
fail_compilation/e15876_3.d(28): Error: found `End of File` when expecting `}` following compound statement
|
||||
fail_compilation/e15876_3.d(28): Error: found `End of File` when expecting `)`
|
||||
fail_compilation/e15876_3.d(28): Error: no identifier for declarator `d(_error_ = ()
|
||||
fail_compilation/e15876_3.d(28): Error: unexpected `(` in declarator
|
||||
fail_compilation/e15876_3.d(28): Error: basic type expected, not `=`
|
||||
fail_compilation/e15876_3.d(29): Error: found `End of File` when expecting `(`
|
||||
fail_compilation/e15876_3.d(29): Error: found `End of File` instead of statement
|
||||
fail_compilation/e15876_3.d(29): Error: expression expected, not `End of File`
|
||||
fail_compilation/e15876_3.d(29): Error: found `End of File` when expecting `;` following `for` condition
|
||||
fail_compilation/e15876_3.d(29): Error: expression expected, not `End of File`
|
||||
fail_compilation/e15876_3.d(29): Error: found `End of File` when expecting `)`
|
||||
fail_compilation/e15876_3.d(29): Error: found `End of File` instead of statement
|
||||
fail_compilation/e15876_3.d(29): Error: matching `}` expected following compound statement, not `End of File`
|
||||
fail_compilation/e15876_3.d(28): unmatched `{`
|
||||
fail_compilation/e15876_3.d(29): Error: found `End of File` when expecting `)`
|
||||
fail_compilation/e15876_3.d(29): Error: no identifier for declarator `d(_error_ = ()
|
||||
{
|
||||
for (__error__
|
||||
0; 0)
|
||||
@ -21,7 +22,7 @@ __error__
|
||||
}
|
||||
}
|
||||
)`
|
||||
fail_compilation/e15876_3.d(28): Error: semicolon expected following function declaration, not `End of File`
|
||||
fail_compilation/e15876_3.d(29): Error: semicolon expected following function declaration, not `End of File`
|
||||
---
|
||||
*/
|
||||
d(={for
|
||||
|
@ -1,17 +1,18 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/e15876_4.d(25): Error: found `)` when expecting `(`
|
||||
fail_compilation/e15876_4.d(26): Error: found `End of File` when expecting `(`
|
||||
fail_compilation/e15876_4.d(26): Error: found `End of File` instead of statement
|
||||
fail_compilation/e15876_4.d(26): Error: expression expected, not `End of File`
|
||||
fail_compilation/e15876_4.d(26): Error: found `End of File` when expecting `;` following `for` condition
|
||||
fail_compilation/e15876_4.d(26): Error: expression expected, not `End of File`
|
||||
fail_compilation/e15876_4.d(26): Error: found `End of File` when expecting `)`
|
||||
fail_compilation/e15876_4.d(26): Error: found `End of File` instead of statement
|
||||
fail_compilation/e15876_4.d(26): Error: found `End of File` when expecting `}` following compound statement
|
||||
fail_compilation/e15876_4.d(26): Error: found `End of File` when expecting `)`
|
||||
fail_compilation/e15876_4.d(26): Error: no identifier for declarator `typeof(()
|
||||
fail_compilation/e15876_4.d(26): Error: found `)` when expecting `(`
|
||||
fail_compilation/e15876_4.d(27): Error: found `End of File` when expecting `(`
|
||||
fail_compilation/e15876_4.d(27): Error: found `End of File` instead of statement
|
||||
fail_compilation/e15876_4.d(27): Error: expression expected, not `End of File`
|
||||
fail_compilation/e15876_4.d(27): Error: found `End of File` when expecting `;` following `for` condition
|
||||
fail_compilation/e15876_4.d(27): Error: expression expected, not `End of File`
|
||||
fail_compilation/e15876_4.d(27): Error: found `End of File` when expecting `)`
|
||||
fail_compilation/e15876_4.d(27): Error: found `End of File` instead of statement
|
||||
fail_compilation/e15876_4.d(27): Error: matching `}` expected following compound statement, not `End of File`
|
||||
fail_compilation/e15876_4.d(26): unmatched `{`
|
||||
fail_compilation/e15876_4.d(27): Error: found `End of File` when expecting `)`
|
||||
fail_compilation/e15876_4.d(27): Error: no identifier for declarator `typeof(()
|
||||
{
|
||||
for (__error__
|
||||
0; 0)
|
||||
|
@ -1,11 +1,12 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/e15876_5.d(16): Error: basic type expected, not `End of File`
|
||||
fail_compilation/e15876_5.d(16): Error: semicolon expected to close `alias` declaration, not `End of File`
|
||||
fail_compilation/e15876_5.d(16): Error: found `End of File` when expecting `}` following compound statement
|
||||
fail_compilation/e15876_5.d(16): Error: found `End of File` when expecting `]`
|
||||
fail_compilation/e15876_5.d(16): Error: no identifier for declarator `p[()
|
||||
fail_compilation/e15876_5.d(17): Error: basic type expected, not `End of File`
|
||||
fail_compilation/e15876_5.d(17): Error: semicolon expected to close `alias` declaration, not `End of File`
|
||||
fail_compilation/e15876_5.d(17): Error: matching `}` expected following compound statement, not `End of File`
|
||||
fail_compilation/e15876_5.d(16): unmatched `{`
|
||||
fail_compilation/e15876_5.d(17): Error: found `End of File` when expecting `]`
|
||||
fail_compilation/e15876_5.d(17): Error: no identifier for declarator `p[()
|
||||
{
|
||||
alias ;
|
||||
}
|
||||
|
@ -58,6 +58,8 @@ TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/enum_init.d(306): Error: variable `enum_init.fooOB.ob` - no definition of struct `S`
|
||||
fail_compilation/enum_init.d(302): required by type `OpaqueBase`
|
||||
fail_compilation/enum_init.d(306): see https://dlang.org/spec/struct.html#opaque_struct_unions
|
||||
fail_compilation/enum_init.d(306): perhaps declare a variable with pointer type `OpaqueBase*` instead
|
||||
---
|
||||
*/
|
||||
#line 300
|
||||
|
@ -12,7 +12,7 @@ alias Tuple!(int, int) TupleType;
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/fail12436.d(18): Error: functions cannot return a function
|
||||
fail_compilation/fail12436.d(19): Error: functions cannot return a tuple
|
||||
fail_compilation/fail12436.d(19): Error: functions cannot return a sequence (use `std.typecons.Tuple`)
|
||||
---
|
||||
*/
|
||||
FuncType test1();
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/fail15755.d(28): Error: `tuple(123)` has no effect
|
||||
fail_compilation/fail15755.d(28): Error: `AliasSeq!(123)` has no effect
|
||||
---
|
||||
*/
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
// https://issues.dlang.org/show_bug.cgi?id=16772
|
||||
/* TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/fail16772.d(7): Error: function `fail16772.ice16772` cannot return type `ubyte[]` because its linkage is `extern(C++)`
|
||||
fail_compilation/fail16772.d(8): Error: function `fail16772.ice16772` cannot return type `ubyte[]` because its linkage is `extern(C++)`
|
||||
fail_compilation/fail16772.d(8): slices are specific to D and do not have a counterpart representation in C++
|
||||
---
|
||||
*/
|
||||
extern(C++) ubyte[] ice16772() { return []; }
|
||||
|
@ -2,7 +2,7 @@
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/fail19209.d(16): Error: function `fail19209.Spammer.method()` does not override any function, did you mean to override variable `fail19209.Spam.method`?
|
||||
fail_compilation/fail19209.d(16): Functions are the only declarations that may be overriden
|
||||
fail_compilation/fail19209.d(16): Functions are the only declarations that may be overridden
|
||||
---
|
||||
*/
|
||||
|
||||
|
@ -1,24 +1,26 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/fail196.d(27): Error: delimited string must end in `)"`
|
||||
fail_compilation/fail196.d(27): Error: implicit string concatenation is error-prone and disallowed in D
|
||||
fail_compilation/fail196.d(27): Use the explicit syntax instead (concatenating literals is `@nogc`): "foo(xxx)" ~ ";\n assert(s == "
|
||||
fail_compilation/fail196.d(28): Error: semicolon needed to end declaration of `s`, instead of `foo`
|
||||
fail_compilation/fail196.d(27): `s` declared here
|
||||
fail_compilation/fail196.d(28): Error: found `");\n\n s = q"` when expecting `;` following statement `foo(xxx)` on line fail_compilation/fail196.d(28)
|
||||
fail_compilation/fail196.d(30): Error: found `";\n assert(s == "` when expecting `;` following statement `[foo[xxx]]` on line fail_compilation/fail196.d(30)
|
||||
fail_compilation/fail196.d(31): Error: found `");\n\n s = q"` when expecting `;` following statement `foo[xxx]` on line fail_compilation/fail196.d(31)
|
||||
fail_compilation/fail196.d(33): Error: found `{` when expecting `;` following statement `foo` on line fail_compilation/fail196.d(33)
|
||||
fail_compilation/fail196.d(33): Error: found `}` when expecting `;` following statement `xxx` on line fail_compilation/fail196.d(33)
|
||||
fail_compilation/fail196.d(34): Error: found `foo` when expecting `;` following statement `";\n assert(s == "` on line fail_compilation/fail196.d(33)
|
||||
fail_compilation/fail196.d(34): Error: found `}` when expecting `;` following statement `xxx` on line fail_compilation/fail196.d(34)
|
||||
fail_compilation/fail196.d(36): Error: found `<` when expecting `;` following statement `");\n\n s = q" < foo` on line fail_compilation/fail196.d(34)
|
||||
fail_compilation/fail196.d(37): Error: found `foo` when expecting `;` following statement `xxx >> ";\n assert(s == "` on line fail_compilation/fail196.d(36)
|
||||
fail_compilation/fail196.d(37): Error: found `<` instead of statement
|
||||
fail_compilation/fail196.d(43): Error: unterminated string constant starting at fail_compilation/fail196.d(43)
|
||||
fail_compilation/fail196.d(45): Error: found `End of File` when expecting `}` following compound statement
|
||||
fail_compilation/fail196.d(45): Error: found `End of File` when expecting `}` following compound statement
|
||||
fail_compilation/fail196.d(29): Error: delimited string must end in `)"`
|
||||
fail_compilation/fail196.d(29): Error: implicit string concatenation is error-prone and disallowed in D
|
||||
fail_compilation/fail196.d(29): Use the explicit syntax instead (concatenating literals is `@nogc`): "foo(xxx)" ~ ";\n assert(s == "
|
||||
fail_compilation/fail196.d(30): Error: semicolon needed to end declaration of `s`, instead of `foo`
|
||||
fail_compilation/fail196.d(29): `s` declared here
|
||||
fail_compilation/fail196.d(30): Error: found `");\n\n s = q"` when expecting `;` following statement `foo(xxx)` on line fail_compilation/fail196.d(30)
|
||||
fail_compilation/fail196.d(32): Error: found `";\n assert(s == "` when expecting `;` following statement `[foo[xxx]]` on line fail_compilation/fail196.d(32)
|
||||
fail_compilation/fail196.d(33): Error: found `");\n\n s = q"` when expecting `;` following statement `foo[xxx]` on line fail_compilation/fail196.d(33)
|
||||
fail_compilation/fail196.d(35): Error: found `{` when expecting `;` following statement `foo` on line fail_compilation/fail196.d(35)
|
||||
fail_compilation/fail196.d(35): Error: found `}` when expecting `;` following statement `xxx` on line fail_compilation/fail196.d(35)
|
||||
fail_compilation/fail196.d(36): Error: found `foo` when expecting `;` following statement `";\n assert(s == "` on line fail_compilation/fail196.d(35)
|
||||
fail_compilation/fail196.d(36): Error: found `}` when expecting `;` following statement `xxx` on line fail_compilation/fail196.d(36)
|
||||
fail_compilation/fail196.d(38): Error: found `<` when expecting `;` following statement `");\n\n s = q" < foo` on line fail_compilation/fail196.d(36)
|
||||
fail_compilation/fail196.d(39): Error: found `foo` when expecting `;` following statement `xxx >> ";\n assert(s == "` on line fail_compilation/fail196.d(38)
|
||||
fail_compilation/fail196.d(39): Error: found `<` instead of statement
|
||||
fail_compilation/fail196.d(45): Error: unterminated string constant starting at fail_compilation/fail196.d(45)
|
||||
fail_compilation/fail196.d(47): Error: matching `}` expected following compound statement, not `End of File`
|
||||
fail_compilation/fail196.d(36): unmatched `{`
|
||||
fail_compilation/fail196.d(47): Error: matching `}` expected following compound statement, not `End of File`
|
||||
fail_compilation/fail196.d(28): unmatched `{`
|
||||
---
|
||||
*/
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
// https://issues.dlang.org/show_bug.cgi?id=21206
|
||||
/* TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/fail21206.d(9): Error: function `fail21206.Obj.toString` cannot return type `string` because its linkage is `extern(C++)`
|
||||
fail_compilation/fail21206.d(10): Error: function `fail21206.Obj.toString` cannot return type `string` because its linkage is `extern(C++)`
|
||||
fail_compilation/fail21206.d(10): slices are specific to D and do not have a counterpart representation in C++
|
||||
---
|
||||
*/
|
||||
extern(C++) struct Obj
|
||||
|
@ -1,12 +1,11 @@
|
||||
// https://issues.dlang.org/show_bug.cgi?id=21275
|
||||
// REQUIRED_ARGS: -de
|
||||
// EXTRA_FILES: imports/fail21275a.d
|
||||
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/fail21275.d(18): Deprecation: function `imports.fail21275a.Foo.x` of type `ref int() return` is not accessible from module `fail21275`
|
||||
fail_compilation/fail21275.d(21): Deprecation: function `imports.fail21275a.Bar.x` of type `int(int)` is not accessible from module `fail21275`
|
||||
fail_compilation/fail21275.d(17): Error: function `imports.fail21275a.Foo.x` of type `ref int() return` is not accessible from module `fail21275`
|
||||
fail_compilation/fail21275.d(20): Error: function `imports.fail21275a.Bar.x` of type `int(int)` is not accessible from module `fail21275`
|
||||
---
|
||||
*/
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/fail222.d(11): Error: template `fail222.getMixin(TArg..., int i = 0)()` template tuple parameter must be last one
|
||||
fail_compilation/fail222.d(11): Error: template `fail222.getMixin(TArg..., int i = 0)()` template sequence parameter must be the last one
|
||||
fail_compilation/fail222.d(18): Error: template instance `getMixin!()` does not match template declaration `getMixin(TArg..., int i = 0)()`
|
||||
fail_compilation/fail222.d(21): Error: template instance `fail222.Thing!()` error instantiating
|
||||
fail_compilation/fail222.d(23): Error: template `fail222.fooBar(A..., B...)()` template tuple parameter must be last one
|
||||
fail_compilation/fail222.d(23): Error: template `fail222.fooBar(A..., B...)()` template sequence parameter must be the last one
|
||||
---
|
||||
*/
|
||||
|
||||
|
39
gcc/testsuite/gdc.test/fail_compilation/fail22729.d
Normal file
39
gcc/testsuite/gdc.test/fail_compilation/fail22729.d
Normal file
@ -0,0 +1,39 @@
|
||||
// https://issues.dlang.org/show_bug.cgi?id=22729
|
||||
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/fail22729.d(12): Error: field `getChildAtPosition` not allowed in interface
|
||||
---
|
||||
*/
|
||||
|
||||
interface ContainerFunctionSetI
|
||||
{
|
||||
Tuple!(WidgetI) getChildAtPosition;
|
||||
}
|
||||
|
||||
interface WidgetI : ContainerFunctionSetI
|
||||
{
|
||||
}
|
||||
|
||||
class Form : WidgetI
|
||||
{
|
||||
}
|
||||
|
||||
template Tuple(Specs)
|
||||
{
|
||||
enum areCompatibleTuples(Tup2)(Tuple tup1, Tup2 tup2)
|
||||
{
|
||||
tup1.field == tup2;
|
||||
}
|
||||
|
||||
struct Tuple
|
||||
{
|
||||
Specs field;
|
||||
|
||||
bool opEquals(R)(R) if (areCompatibleTuples!R)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/fail23745.d(21): Error: undefined identifier `UndefinedType`
|
||||
fail_compilation/fail23745.d(14): Error: function `fun` does not override any function, did you mean to override `fail23745.A.fun`?
|
||||
fail_compilation/fail23745.d(21): Function `fail23745.A.fun` contains errors in its declaration, therefore it cannot be correctly overriden
|
||||
fail_compilation/fail23745.d(21): Function `fail23745.A.fun` contains errors in its declaration, therefore it cannot be correctly overridden
|
||||
---
|
||||
*/
|
||||
|
||||
|
@ -1,13 +1,14 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/fail315.d-mixin-16(16): Error: found `;` when expecting `,`
|
||||
fail_compilation/fail315.d-mixin-16(16): Error: expression expected, not `}`
|
||||
fail_compilation/fail315.d-mixin-16(16): Error: found `End of File` when expecting `,`
|
||||
fail_compilation/fail315.d-mixin-16(16): Error: found `End of File` when expecting `]`
|
||||
fail_compilation/fail315.d-mixin-16(16): Error: found `End of File` when expecting `;` following `return` statement
|
||||
fail_compilation/fail315.d-mixin-16(16): Error: found `End of File` when expecting `}` following compound statement
|
||||
fail_compilation/fail315.d(21): Error: template instance `fail315.foo!()` error instantiating
|
||||
fail_compilation/fail315.d-mixin-17(17): Error: found `;` when expecting `,`
|
||||
fail_compilation/fail315.d-mixin-17(17): Error: expression expected, not `}`
|
||||
fail_compilation/fail315.d-mixin-17(17): Error: found `End of File` when expecting `,`
|
||||
fail_compilation/fail315.d-mixin-17(17): Error: found `End of File` when expecting `]`
|
||||
fail_compilation/fail315.d-mixin-17(17): Error: found `End of File` when expecting `;` following `return` statement
|
||||
fail_compilation/fail315.d-mixin-17(17): Error: matching `}` expected following compound statement, not `End of File`
|
||||
fail_compilation/fail315.d-mixin-17(17): unmatched `{`
|
||||
fail_compilation/fail315.d(22): Error: template instance `fail315.foo!()` error instantiating
|
||||
---
|
||||
*/
|
||||
|
||||
|
21
gcc/testsuite/gdc.test/fail_compilation/funcpostattr.d
Normal file
21
gcc/testsuite/gdc.test/fail_compilation/funcpostattr.d
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/funcpostattr.d(11): Error: `deprecated` token is not allowed in postfix position
|
||||
fail_compilation/funcpostattr.d(11): Error: `extern` token is not allowed in postfix position
|
||||
fail_compilation/funcpostattr.d(15): Error: `static` token is not allowed in postfix position
|
||||
fail_compilation/funcpostattr.d(15): Error: `ref` token is not allowed in postfix position
|
||||
fail_compilation/funcpostattr.d(20): Error: `override` token is not allowed in postfix position
|
||||
---
|
||||
*/
|
||||
void foo() deprecated extern;
|
||||
|
||||
void main() {
|
||||
int i;
|
||||
int foo() static ref => i;
|
||||
}
|
||||
|
||||
class C
|
||||
{
|
||||
void foo() override {}
|
||||
}
|
@ -1,10 +1,11 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/ice11965.d(15): Error: no identifier for declarator `b*`
|
||||
fail_compilation/ice11965.d(15): Error: found `End of File` when expecting `}` following compound statement
|
||||
fail_compilation/ice11965.d(15): Error: found `End of File` when expecting `]`
|
||||
fail_compilation/ice11965.d(15): Error: no identifier for declarator `u[()
|
||||
fail_compilation/ice11965.d(16): Error: no identifier for declarator `b*`
|
||||
fail_compilation/ice11965.d(16): Error: matching `}` expected following compound statement, not `End of File`
|
||||
fail_compilation/ice11965.d(15): unmatched `{`
|
||||
fail_compilation/ice11965.d(16): Error: found `End of File` when expecting `]`
|
||||
fail_compilation/ice11965.d(16): Error: no identifier for declarator `u[()
|
||||
{
|
||||
b* A;
|
||||
}
|
||||
|
@ -1,19 +1,20 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/ice11982.d(19): Error: basic type expected, not `scope`
|
||||
fail_compilation/ice11982.d(19): Error: found `scope` when expecting `;` following statement `new _error_` on line fail_compilation/ice11982.d(19)
|
||||
fail_compilation/ice11982.d(19): Error: basic type expected, not `}`
|
||||
fail_compilation/ice11982.d(19): Error: missing `{ ... }` for function literal
|
||||
fail_compilation/ice11982.d(19): Error: C style cast illegal, use `cast(funk)function _error_()
|
||||
fail_compilation/ice11982.d(20): Error: basic type expected, not `scope`
|
||||
fail_compilation/ice11982.d(20): Error: found `scope` when expecting `;` following statement `new _error_` on line fail_compilation/ice11982.d(20)
|
||||
fail_compilation/ice11982.d(20): Error: basic type expected, not `}`
|
||||
fail_compilation/ice11982.d(20): Error: missing `{ ... }` for function literal
|
||||
fail_compilation/ice11982.d(20): Error: C style cast illegal, use `cast(funk)function _error_()
|
||||
{
|
||||
}
|
||||
`
|
||||
fail_compilation/ice11982.d(19): Error: found `}` when expecting `;` following statement `cast(funk)function _error_()
|
||||
fail_compilation/ice11982.d(20): Error: found `}` when expecting `;` following statement `cast(funk)function _error_()
|
||||
{
|
||||
}
|
||||
` on line fail_compilation/ice11982.d(19)
|
||||
fail_compilation/ice11982.d(20): Error: found `End of File` when expecting `}` following compound statement
|
||||
` on line fail_compilation/ice11982.d(20)
|
||||
fail_compilation/ice11982.d(21): Error: matching `}` expected following compound statement, not `End of File`
|
||||
fail_compilation/ice11982.d(20): unmatched `{`
|
||||
---
|
||||
*/
|
||||
void main() { new scope ( funk ) function }
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/ice12574.d(40): Error: tuple index `2` out of bounds `[0 .. 2]`
|
||||
fail_compilation/ice12574.d(40): Error: sequence index `2` out of bounds `[0 .. 2]`
|
||||
fail_compilation/ice12574.d(53): Error: template instance `ice12574.reduce!("a", "a").reduce!(Tuple!(int, int, int))` error instantiating
|
||||
---
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/ice14424.d(13): Error: `tuple(__unittest_L3_C1)` has no effect
|
||||
fail_compilation/ice14424.d(13): Error: `AliasSeq!(__unittest_L3_C1)` has no effect
|
||||
---
|
||||
*/
|
||||
|
||||
|
@ -2,16 +2,17 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/ice15855.d(27): Error: found `End of File` when expecting `(`
|
||||
fail_compilation/ice15855.d(27): Error: found `End of File` instead of statement
|
||||
fail_compilation/ice15855.d(27): Error: expression expected, not `End of File`
|
||||
fail_compilation/ice15855.d(27): Error: found `End of File` when expecting `;` following `for` condition
|
||||
fail_compilation/ice15855.d(27): Error: expression expected, not `End of File`
|
||||
fail_compilation/ice15855.d(27): Error: found `End of File` when expecting `)`
|
||||
fail_compilation/ice15855.d(27): Error: found `End of File` instead of statement
|
||||
fail_compilation/ice15855.d(27): Error: found `End of File` when expecting `}` following compound statement
|
||||
fail_compilation/ice15855.d(27): Error: found `End of File` when expecting `]`
|
||||
fail_compilation/ice15855.d(27): Error: no identifier for declarator `a[()
|
||||
fail_compilation/ice15855.d(28): Error: found `End of File` when expecting `(`
|
||||
fail_compilation/ice15855.d(28): Error: found `End of File` instead of statement
|
||||
fail_compilation/ice15855.d(28): Error: expression expected, not `End of File`
|
||||
fail_compilation/ice15855.d(28): Error: found `End of File` when expecting `;` following `for` condition
|
||||
fail_compilation/ice15855.d(28): Error: expression expected, not `End of File`
|
||||
fail_compilation/ice15855.d(28): Error: found `End of File` when expecting `)`
|
||||
fail_compilation/ice15855.d(28): Error: found `End of File` instead of statement
|
||||
fail_compilation/ice15855.d(28): Error: matching `}` expected following compound statement, not `End of File`
|
||||
fail_compilation/ice15855.d(27): unmatched `{`
|
||||
fail_compilation/ice15855.d(28): Error: found `End of File` when expecting `]`
|
||||
fail_compilation/ice15855.d(28): Error: no identifier for declarator `a[()
|
||||
{
|
||||
for (__error__
|
||||
0; 0)
|
||||
|
@ -0,0 +1,8 @@
|
||||
module imports.issue23947a;
|
||||
|
||||
struct X { }
|
||||
struct Y { }
|
||||
class Class {
|
||||
private void handle(X x) { }
|
||||
public void handle(Y y) { }
|
||||
}
|
@ -1,12 +1,19 @@
|
||||
// https://issues.dlang.org/show_bug.cgi?id=20422
|
||||
|
||||
/*
|
||||
REQUIRED_ARGS: -m32
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/issue20422.d(11): Error: missing length argument for array
|
||||
fail_compilation/issue20422.d(15): Error: missing length argument for array
|
||||
fail_compilation/issue20422.d(16): Error: negative array dimension `-1`
|
||||
fail_compilation/issue20422.d(17): Error: negative array dimension `-2147483648`
|
||||
fail_compilation/issue20422.d(18): Error: too many arguments for array
|
||||
---
|
||||
*/
|
||||
|
||||
void main() {
|
||||
new int[];
|
||||
new int[-1];
|
||||
new int[](int.min);
|
||||
new int[](1, 2);
|
||||
}
|
||||
|
10
gcc/testsuite/gdc.test/fail_compilation/issue23947.d
Normal file
10
gcc/testsuite/gdc.test/fail_compilation/issue23947.d
Normal file
@ -0,0 +1,10 @@
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23947
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/issue23947.d(10): Error: function `imports.issue23947a.Class.handle` of type `void(X x)` is not accessible from module `issue23947`
|
||||
---
|
||||
*/
|
||||
import imports.issue23947a;
|
||||
|
||||
void main() { Class.init.handle(X.init); }
|
@ -8,7 +8,7 @@ fail_compilation/lexer4.d(26): Error: binary digit expected, not `2`
|
||||
fail_compilation/lexer4.d(27): Error: octal digit expected, not `8`
|
||||
fail_compilation/lexer4.d(27): Error: octal literals larger than 7 are no longer supported
|
||||
fail_compilation/lexer4.d(28): Error: decimal digit expected, not `a`
|
||||
fail_compilation/lexer4.d(29): Error: unrecognized token
|
||||
fail_compilation/lexer4.d(29): Error: repeated integer suffix `U`
|
||||
fail_compilation/lexer4.d(30): Error: exponent required for hex float
|
||||
fail_compilation/lexer4.d(31): Error: lower case integer suffix 'l' is not allowed. Please use 'L' instead
|
||||
fail_compilation/lexer4.d(32): Error: use 'i' suffix instead of 'I'
|
||||
|
@ -24,7 +24,8 @@ fail_compilation/misc_parser_err_cov1.d(40): Error: identifier or `new` expected
|
||||
fail_compilation/misc_parser_err_cov1.d(41): Error: identifier or new keyword expected following `(...)`.
|
||||
fail_compilation/misc_parser_err_cov1.d(41): Error: expression expected, not `;`
|
||||
fail_compilation/misc_parser_err_cov1.d(42): Error: found `}` when expecting `;` following statement `(__error) + 0` on line fail_compilation/misc_parser_err_cov1.d(41)
|
||||
fail_compilation/misc_parser_err_cov1.d(43): Error: found `End of File` when expecting `}` following compound statement
|
||||
fail_compilation/misc_parser_err_cov1.d(43): Error: matching `}` expected following compound statement, not `End of File`
|
||||
fail_compilation/misc_parser_err_cov1.d(33): unmatched `{`
|
||||
---
|
||||
*/
|
||||
module misc_parser_err_cov1;
|
||||
|
10
gcc/testsuite/gdc.test/fail_compilation/missingbrace.d
Normal file
10
gcc/testsuite/gdc.test/fail_compilation/missingbrace.d
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/missingbrace.d(11): Error: matching `}` expected following compound statement, not `End of File`
|
||||
fail_compilation/missingbrace.d(9): unmatched `{`
|
||||
---
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
int a;
|
@ -403,7 +403,7 @@ class Foo13
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/retscope.d(1205): Error: scope variable `f14` calling non-scope member function `f14.foo()`
|
||||
fail_compilation/retscope.d(1205): Error: scope variable `f14` calling non-scope member function `Foo14.foo()`
|
||||
---
|
||||
*/
|
||||
|
||||
|
@ -9,7 +9,7 @@ fail_compilation/test20245.d(27): Error: cannot take address of `scope` variable
|
||||
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` calling non-scope member function `this.this()`
|
||||
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(82): which is not `scope` because of `charPtr = content`
|
||||
---
|
||||
|
25
gcc/testsuite/gdc.test/fail_compilation/test21025.d
Normal file
25
gcc/testsuite/gdc.test/fail_compilation/test21025.d
Normal file
@ -0,0 +1,25 @@
|
||||
// https://issues.dlang.org/show_bug.cgi?id=21025
|
||||
// REQUIRED_ARGS: -preview=dip1021
|
||||
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/test21025.d(15): Error: variable `r` cannot be read at compile time
|
||||
fail_compilation/test21025.d(15): called from here: `binaryFun(r, r)`
|
||||
fail_compilation/test21025.d(24): Error: template `test21025.uniq` is not callable using argument types `!()(void[])`
|
||||
fail_compilation/test21025.d(14): Candidate is: `uniq()(int[] r)`
|
||||
---
|
||||
*/
|
||||
|
||||
void uniq()(int[] r)
|
||||
if (binaryFun(r, r)) {}
|
||||
|
||||
bool binaryFun(T, U)(T, U)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void generateStatements()
|
||||
{
|
||||
uniq([]);
|
||||
}
|
23
gcc/testsuite/gdc.test/fail_compilation/test23968.d
Normal file
23
gcc/testsuite/gdc.test/fail_compilation/test23968.d
Normal file
@ -0,0 +1,23 @@
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23968
|
||||
|
||||
// REQUIRED_ARGS: -de
|
||||
|
||||
/*
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/test23968.d(22): Deprecation: alias `test23968.a` is deprecated
|
||||
---
|
||||
*/
|
||||
|
||||
int fun()(int)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
deprecated alias a = fun;
|
||||
|
||||
void main()
|
||||
{
|
||||
int v;
|
||||
int y = v.a!(); // No deprecation?
|
||||
}
|
36
gcc/testsuite/gdc.test/fail_compilation/test23982.d
Normal file
36
gcc/testsuite/gdc.test/fail_compilation/test23982.d
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
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(26): which is not `scope` because of `b = a`
|
||||
---
|
||||
*/
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23982
|
||||
// Issue 23982 - segfault when printing scope inference failure
|
||||
@safe:
|
||||
|
||||
struct B()
|
||||
{
|
||||
this(int* a)
|
||||
{
|
||||
this.a = a;
|
||||
}
|
||||
int* a;
|
||||
}
|
||||
|
||||
class C()
|
||||
{
|
||||
int* foo2(int* a)
|
||||
{
|
||||
auto b = B!()(a);
|
||||
return b.a;
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
scope int* a;
|
||||
C!() c;
|
||||
c.foo2(a);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user