Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ ifeq (solaris,$(OS))
endif

# Set DFLAGS
UDFLAGS:=-conf= -Isrc -Iimport -w -dip1000 -preview=fieldwise $(MODEL_FLAG) $(PIC) $(OPTIONAL_COVERAGE)
UDFLAGS:=-conf= -Isrc -Iimport -w -de -dip1000 -preview=fieldwise $(MODEL_FLAG) $(PIC) $(OPTIONAL_COVERAGE)
ifeq ($(BUILD),debug)
UDFLAGS += -g -debug
DFLAGS:=$(UDFLAGS)
Expand Down
4 changes: 2 additions & 2 deletions src/core/internal/arrayop.d
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ template typeCheck(bool fail, T, Args...)
{
alias UT = Args[idx - 1];
enum op = Args[idx][1 .. $];
static if (is(typeof((UT a) => mixin(op ~ " a")) RT == return))
static if (is(typeof((UT a) => mixin(op ~ "cast(int) a")) RT == return))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could also have used -preview=intpromote here, but as this wouldn't be there when any user code tries to use this, I went with the "safe" approach of explicitly using the existing behavior.

alias typeCheck = typeCheck!(fail, T, Args[0 .. idx - 1], RT, Args[idx + 1 .. $]);
else static if (fail)
static assert(0, "Unary `" ~ op ~ "` not supported for type `" ~ UT.stringof ~ "`.");
Expand Down Expand Up @@ -271,7 +271,7 @@ string scalarExp(Args...)()
else static if (isUnaryOp(arg))
{
auto op = arg[0] == 'u' ? arg[1 .. $] : arg;
stack[$ - 1] = op ~ stack[$ - 1];
stack[$ - 1] = op ~ "cast(int)"~ stack[$ - 1];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the culprit. Deleting "cast(int)"~ fixes the problem.

I think there's a missing check that Args contains integral types! The cast causes problems when performing array ops on double[].

}
else static if (arg == "=")
{
Expand Down
4 changes: 1 addition & 3 deletions src/core/sync/event.d
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ unittest
{
import core.thread, core.atomic;

auto event = new Event(true, false);
scope event = new Event(true, false);
int numThreads = 10;
shared int numRunning = 0;

Expand All @@ -326,6 +326,4 @@ unittest
assert(numRunning == numThreads);

assert(MonoTime.currTime - start < 5.dur!"seconds");

delete event;
}
15 changes: 14 additions & 1 deletion src/core/time.d
Original file line number Diff line number Diff line change
Expand Up @@ -3615,12 +3615,25 @@ public:
return FracSec(hnsecs);
}

unittest
deprecated unittest
{
assert(FracSec.from!"msecs"(0) == FracSec(0));
assert(FracSec.from!"usecs"(0) == FracSec(0));
assert(FracSec.from!"hnsecs"(0) == FracSec(0));

// workaround for https://issues.dlang.org/show_bug.cgi?id=19789
void _assertThrown(T : Throwable = Exception, E)
(lazy E expression,
string msg = null)
{
bool thrown = false;
try
expression();
catch (T t)
thrown = true;
assert(thrown, "No exception was thrown.");
}

foreach (sign; [1, -1])
{
_assertThrown!TimeException(from!"msecs"(1000 * sign));
Expand Down
4 changes: 2 additions & 2 deletions src/rt/lifetime.d
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,7 @@ extern (C) void _d_delarray_t(void[]* p, const TypeInfo_Struct ti)
}
}

unittest
deprecated unittest
{
__gshared size_t countDtor = 0;
struct S
Expand Down Expand Up @@ -2567,7 +2567,7 @@ unittest

// test struct finalizers
debug(SENTINEL) {} else
unittest
deprecated unittest
{
__gshared int dtorCount;
static struct S1
Expand Down