diff --git a/VERSION b/VERSION index bb2ac29e6440..a619f742fcc5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.102.0 +v2.102.1-beta.1 diff --git a/compiler/src/dmd/cparse.d b/compiler/src/dmd/cparse.d index 3ba7a6e27329..57ca35503090 100644 --- a/compiler/src/dmd/cparse.d +++ b/compiler/src/dmd/cparse.d @@ -1840,6 +1840,8 @@ final class CParser(AST) : Parser!AST { if (tt.id || tt.tok == TOK.enum_) { + if (!tt.id && id) + tt.id = id; Specifier spec; auto stag = declareTag(tt, spec); if (tt.tok == TOK.enum_) @@ -3015,11 +3017,11 @@ final class CParser(AST) : Parser!AST auto param = new AST.Parameter(specifiersToSTC(LVL.parameter, specifier), t, id, null, null); parameters.push(param); - if (token.value == TOK.rightParenthesis) + if (token.value == TOK.rightParenthesis || token.value == TOK.endOfFile) break; check(TOK.comma); } - nextToken(); + check(TOK.rightParenthesis); return finish(); } diff --git a/compiler/src/dmd/expressionsem.d b/compiler/src/dmd/expressionsem.d index 9c2f277eb59b..ab8fa17d611f 100644 --- a/compiler/src/dmd/expressionsem.d +++ b/compiler/src/dmd/expressionsem.d @@ -12098,6 +12098,15 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor __equals = new DotIdExp(exp.loc, __equals, Id.object); __equals = new DotIdExp(exp.loc, __equals, id); + /* https://issues.dlang.org/show_bug.cgi?id=23674 + * + * Optimize before creating the call expression to the + * druntime hook as the optimizer may output errors + * that will get swallowed otherwise. + */ + exp.e1 = exp.e1.optimize(WANTvalue); + exp.e2 = exp.e2.optimize(WANTvalue); + auto arguments = new Expressions(2); (*arguments)[0] = exp.e1; (*arguments)[1] = exp.e2; diff --git a/compiler/src/dmd/toobj.d b/compiler/src/dmd/toobj.d index 57e2c8902c44..4978956192ce 100644 --- a/compiler/src/dmd/toobj.d +++ b/compiler/src/dmd/toobj.d @@ -580,7 +580,7 @@ void toObjFile(Dsymbol ds, bool multiobj) vd.error("size overflow"); return; } - if (sz64 >= target.maxStaticDataSize) + if (sz64 > target.maxStaticDataSize) { vd.error("size of 0x%llx exceeds max allowed size 0x%llx", sz64, target.maxStaticDataSize); } diff --git a/compiler/src/dmd/typesem.d b/compiler/src/dmd/typesem.d index db4e53e71f41..65ddbf525a61 100644 --- a/compiler/src/dmd/typesem.d +++ b/compiler/src/dmd/typesem.d @@ -593,7 +593,7 @@ extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc) * run on them for the size, since they may be forward referenced. */ bool overflow = false; - if (mulu(tbn.size(loc), d2, overflow) >= target.maxStaticDataSize || overflow) + if (mulu(tbn.size(loc), d2, overflow) > target.maxStaticDataSize || overflow) return overflowError(); } } diff --git a/compiler/test/compilable/imports/imp23662.c b/compiler/test/compilable/imports/imp23662.c new file mode 100644 index 000000000000..1556bc9e3d98 --- /dev/null +++ b/compiler/test/compilable/imports/imp23662.c @@ -0,0 +1,6 @@ +// https://issues.dlang.org/show_bug.cgi?id=23662 +typedef enum {A} E; + +E func(E v) { + return v; +} diff --git a/compiler/test/compilable/test23662.d b/compiler/test/compilable/test23662.d new file mode 100644 index 000000000000..884c3995925f --- /dev/null +++ b/compiler/test/compilable/test23662.d @@ -0,0 +1,8 @@ +// https://issues.dlang.org/show_bug.cgi?id=23662 +// EXTRA_FILES: imports/imp23662.c +import imports.imp23662; + +void main(string[] args) { + auto r = func(A); + assert(r == A); +} diff --git a/compiler/test/compilable/test23679.d b/compiler/test/compilable/test23679.d new file mode 100644 index 000000000000..9264d01928dc --- /dev/null +++ b/compiler/test/compilable/test23679.d @@ -0,0 +1,3 @@ +// DISABLED: win32 +// https://issues.dlang.org/show_bug.cgi?id=23679 +ubyte [0x7fff_ffffU] arr; diff --git a/compiler/test/fail_compilation/test23672.i b/compiler/test/fail_compilation/test23672.i new file mode 100644 index 000000000000..fd406bd95507 --- /dev/null +++ b/compiler/test/fail_compilation/test23672.i @@ -0,0 +1,8 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/test23672.i(9): Error: found `End of File` when expecting `)` +fail_compilation/test23672.i(9): Error: `=`, `;` or `,` expected to end declaration instead of `End of File` +--- +*/ +extern int feof (FILE *__strea diff --git a/compiler/test/fail_compilation/test23674.d b/compiler/test/fail_compilation/test23674.d new file mode 100644 index 000000000000..0f11de94d9da --- /dev/null +++ b/compiler/test/fail_compilation/test23674.d @@ -0,0 +1,15 @@ +// https://issues.dlang.org/show_bug.cgi?id=23674 + +/* +TEST_OUTPUT: +--- +fail_compilation/test23674.d(14): Error: array index 2 is out of bounds `arr[0 .. 2]` +fail_compilation/test23674.d(14): Error: array index 3 is out of bounds `arr[0 .. 2]` +--- +*/ + +void main() +{ + string[2] arr; + assert(arr[2] == arr[3]); +} diff --git a/druntime/src/core/demangle.d b/druntime/src/core/demangle.d index fe273319f213..a68e509c7220 100644 --- a/druntime/src/core/demangle.d +++ b/druntime/src/core/demangle.d @@ -2933,7 +2933,7 @@ CXX_DEMANGLER getCXXDemangler() nothrow @trusted version (linux) import core.sys.linux.dlfcn : RTLD_DEFAULT; version (NetBSD) import core.sys.netbsd.dlfcn : RTLD_DEFAULT; version (OpenBSD) import core.sys.openbsd.dlfcn : RTLD_DEFAULT; - version (OSX) import core.sys.darwin.dlfcn : RTLD_DEFAULT; + version (Darwin) import core.sys.darwin.dlfcn : RTLD_DEFAULT; version (Solaris) import core.sys.solaris.dlfcn : RTLD_DEFAULT; if (auto found = cast(CXX_DEMANGLER) dlsym(RTLD_DEFAULT, "__cxa_demangle"))