Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.
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 gcc/d/dmd/expressionsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -8923,7 +8923,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
TypeAArray ta = cast(TypeAArray)t2b;

// Special handling for array keys
if (!arrayTypeCompatible(exp.e1.loc, exp.e1.type, ta.index))
if (!arrayTypeCompatibleWithoutCasting(exp.e1.type, ta.index))
{
// Convert key to type of key
exp.e1 = exp.e1.implicitCastTo(sc, ta.index);
Expand Down
2 changes: 1 addition & 1 deletion gcc/d/dmd/traits.d
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ extern (C++) Expression semanticTraits(TraitsExp e, Scope* sc)
// If the symbol passed as a parameter is an
// interface that inherits other interfaces
overloadApply(f, &dg);
if (ifd && ifd.interfaces)
if (ifd && ifd.interfaces && f)
{
// check the overloads of each inherited interface individually
foreach (bc; ifd.interfaces)
Expand Down
2 changes: 1 addition & 1 deletion gcc/d/verstr.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"2.081.1"
"2.081.2"
11 changes: 11 additions & 0 deletions gcc/testsuite/gdc.test/fail_compilation/fail19076.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail19076.d(11): Error: no property `V` for type `fail19076.I`
fail_compilation/fail19076.d(11): Error: `(I).V` cannot be resolved
---
*/

interface P { }
interface I : P { }
auto F = __traits(getVirtualFunctions, I, "V");
16 changes: 16 additions & 0 deletions gcc/testsuite/gdc.test/fail_compilation/test19112.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* TEST_OUTPUT:
---
fail_compilation/test19112.d(13): Error: cannot implicitly convert expression `[123, 456]` of type `int[]` to `int[1]`
fail_compilation/test19112.d(15): Error: cannot implicitly convert expression `a` of type `int[]` to `int[1]`
---
*/

// https://issues.dlang.org/show_bug.cgi?id=19112

void main()
{
int[int[1]] aa;
int* p = [123, 456] in aa;
int[] a;
p = a in aa;
}
4 changes: 2 additions & 2 deletions libphobos/configure
Original file line number Diff line number Diff line change
Expand Up @@ -14557,8 +14557,8 @@ SPEC_PHOBOS_DEPS="$LIBS"


# Libdruntime / phobos soname version
DRUNTIME_SOVERSION="76:2:0"
PHOBOS_SOVERSION="76:2:0"
DRUNTIME_SOVERSION="81:2:0"
PHOBOS_SOVERSION="81:2:0"



Expand Down
4 changes: 2 additions & 2 deletions libphobos/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ SPEC_PHOBOS_DEPS="$LIBS"
AC_SUBST(SPEC_PHOBOS_DEPS)

# Libdruntime / phobos soname version
DRUNTIME_SOVERSION="76:2:0"
PHOBOS_SOVERSION="76:2:0"
DRUNTIME_SOVERSION="81:2:0"
PHOBOS_SOVERSION="81:2:0"
AC_SUBST([DRUNTIME_SOVERSION])
AC_SUBST([PHOBOS_SOVERSION])

Expand Down
20 changes: 19 additions & 1 deletion libphobos/libdruntime/core/memory.d
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ void __delete(T)(ref T x) @system
}
else static if (is(T : E2[], E2))
{
GC.free(x.ptr);
GC.free(cast(void*) x.ptr);
x = null;
}
}
Expand Down Expand Up @@ -1167,3 +1167,21 @@ unittest
int* pint; __delete(pint);
S* ps; __delete(ps);
}

// https://issues.dlang.org/show_bug.cgi?id=19092
unittest
{
const(int)[] x = [1, 2, 3];
assert(GC.addrOf(x.ptr) != null);
__delete(x);
assert(x is null);
assert(GC.addrOf(x.ptr) == null);

immutable(int)[] y = [1, 2, 3];
assert(GC.addrOf(y.ptr) != null);
__delete(y);
assert(y is null);
assert(GC.addrOf(y.ptr) == null);
}


3 changes: 1 addition & 2 deletions libphobos/src/std/conv.d
Original file line number Diff line number Diff line change
Expand Up @@ -2737,7 +2737,6 @@ Target parse(Target, Source)(ref Source source)
if (isInputRange!Source && isSomeChar!(ElementType!Source) && !is(Source == enum) &&
isFloatingPoint!Target && !is(Target == enum))
{
import core.stdc.math : HUGE_VAL;
import std.ascii : isDigit, isAlpha, toLower, toUpper, isHexDigit;
import std.exception : enforce;

Expand Down Expand Up @@ -3240,7 +3239,7 @@ if (isInputRange!Source && isSomeChar!(ElementType!Source) && !is(Source == enum
}
}
L6: // if overflow occurred
enforce(ldval != HUGE_VAL, new ConvException("Range error"));
enforce(ldval != real.infinity, new ConvException("Range error"));

L1:
static if (isNarrowString!Source)
Expand Down
3 changes: 1 addition & 2 deletions libphobos/src/std/random.d
Original file line number Diff line number Diff line change
Expand Up @@ -2182,8 +2182,7 @@ do
immutable T u = (rng.front - rng.min) * factor;
rng.popFront();

import core.stdc.limits : CHAR_BIT; // CHAR_BIT is always 8
static if (isIntegral!R && T.mant_dig >= (CHAR_BIT * R.sizeof))
static if (isIntegral!R && T.mant_dig >= (8 * R.sizeof))
{
/* If RNG variates are integral and T has enough precision to hold
* R without loss, we're guaranteed by the definition of factor
Expand Down
11 changes: 8 additions & 3 deletions libphobos/src/std/range/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -8587,13 +8587,11 @@ public:
* gap: (7 - 4) % 2 = 3 % 2 = 1
* end: 7 - 1 = 6
*/
pragma(inline, true);
return (source.length - windowSize) % stepSize;
}

private size_t numberOfFullFrames()
{
pragma(inline, true);
/**
5.iota.slides(2, 1) => [0, 1], [1, 2], [2, 3], [3, 4] (4)
7.iota.slides(2, 2) => [0, 1], [2, 3], [4, 5], [6] (3)
Expand All @@ -8610,7 +8608,6 @@ public:
// Whether the last slide frame size is less than windowSize
private bool hasPartialElements()
{
pragma(inline, true);
static if (withPartial)
return gap != 0 && source.length > numberOfFullFrames * stepSize;
else
Expand Down Expand Up @@ -9387,6 +9384,14 @@ public:
}}
}

// https://issues.dlang.org/show_bug.cgi?id=19082
@safe unittest
{
import std.algorithm.comparison : equal;
import std.algorithm.iteration : map;
assert([1].map!(x => x).slide(2).equal!equal([[1]]));
}

private struct OnlyResult(T, size_t arity)
{
private this(Values...)(auto ref Values values)
Expand Down