Skip to content

Commit 0cc47d9

Browse files
committed
Merge remote-tracking branch 'origin/dmd-rewrite-stable' into merge_stable
2 parents dd45ddb + d81acf0 commit 0cc47d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+182
-87
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# LDC master
22

33
#### Big news
4-
- Frontend, druntime and Phobos are at version [2.110.0](https://dlang.org/changelog/2.110.0.html). (#4707, #4737, #4749, #4768, #4784)
4+
- Frontend, druntime and Phobos are at version [2.110.0](https://dlang.org/changelog/2.110.0.html). (#4707, #4737, #4749, #4768, #4784, #4792)
55
- Support for [LLVM 19](https://releases.llvm.org/19.1.0/docs/ReleaseNotes.html); LLVM for prebuilt packages bumped to v19.1.3 (incl. macOS arm64). (#4712, #4735, #4763, #4772)
66
- Android: NDK for prebuilt package bumped from r26d to r27c. (#4711, #4772)
77
- ldc2.conf: %%ldcconfigpath%% placeholder added - specifies the directory where current configuration file is located. (#4717)

dmd/expressionsem.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5554,7 +5554,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
55545554
{
55555555
if (exp.fd.ident == Id.empty)
55565556
{
5557-
const(char)[] s;
5557+
string s;
55585558
if (exp.fd.fes)
55595559
s = "__foreachbody";
55605560
else if (exp.fd.tok == TOK.reserved)
@@ -5588,7 +5588,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
55885588
symtab = sds.symtab;
55895589
}
55905590
assert(symtab);
5591-
Identifier id = Identifier.generateId(s, symtab.length() + 1);
5591+
Identifier id = Identifier.generateIdWithLoc(s, exp.loc);
55925592
exp.fd.ident = id;
55935593
if (exp.td)
55945594
exp.td.ident = id;

dmd/frontend.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8692,6 +8692,7 @@ struct Id final
86928692
static Identifier* isRef;
86938693
static Identifier* isOut;
86948694
static Identifier* isLazy;
8695+
static Identifier* isCOMClass;
86958696
static Identifier* hasMember;
86968697
static Identifier* identifier;
86978698
static Identifier* fullyQualifiedName;

dmd/id.d

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ immutable Msgtable[] msgtable =
482482
{ "isRef" },
483483
{ "isOut" },
484484
{ "isLazy" },
485+
{ "isCOMClass" },
485486
{ "hasMember" },
486487
{ "identifier" },
487488
{ "fullyQualifiedName" },

dmd/traits.d

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,26 @@ Expression semanticTraits(TraitsExp e, Scope* sc)
693693

694694
return isDeclX(d => (d.storage_class & STC.lazy_) != 0);
695695
}
696+
if (e.ident == Id.isCOMClass)
697+
{
698+
if (dim != 1)
699+
return dimError(1);
700+
701+
auto o = (*e.args)[0];
702+
auto s = getDsymbol(o);
703+
AggregateDeclaration agg;
704+
705+
if (!s || ((agg = s.isAggregateDeclaration()) is null))
706+
{
707+
error(e.loc, "argument to `__traits(isCOMClass, %s)` is not a declaration", o.toChars());
708+
return ErrorExp.get();
709+
}
710+
711+
if (ClassDeclaration cd = agg.isClassDeclaration())
712+
return cd.com ? True() : False();
713+
else
714+
return False();
715+
}
696716
if (e.ident == Id.identifier)
697717
{
698718
// Get identifier for symbol as a string literal

runtime/druntime/src/core/internal/array/arrayassign.d

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ Tarr _d_arraysetassign(Tarr : T[], T)(return scope Tarr to, scope ref T value) @
347347
static if (__traits(isCopyable, T))
348348
copyEmplace(value, dst);
349349
else
350-
memcpy(cast(void*) &value, cast(void*) &dst, elemSize);
350+
memcpy(cast(void*) &dst, cast(void*) &value, elemSize);
351351
auto elem = cast(Unqual!T*) &tmp;
352352
destroy(*elem);
353353
}
@@ -395,6 +395,20 @@ Tarr _d_arraysetassign(Tarr : T[], T)(return scope Tarr to, scope ref T value) @
395395
assert(arr == [S(1234), S(1234), S(1234), S(1234)]);
396396
}
397397

398+
// disabled copy constructor
399+
@safe unittest
400+
{
401+
static struct S
402+
{
403+
int val;
404+
@disable this(ref S);
405+
}
406+
S[1] arr;
407+
S s = S(1234);
408+
_d_arraysetassign(arr[], s);
409+
assert(arr[0].val == 1234);
410+
}
411+
398412
// throwing and `nothrow`
399413
@safe nothrow unittest
400414
{

runtime/druntime/src/core/lifetime.d

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2739,8 +2739,11 @@ if (is(T == class))
27392739
auto init = __traits(initSymbol, T);
27402740
void* p;
27412741

2742-
static if (__traits(getLinkage, T) == "Windows")
2742+
static if (__traits(isCOMClass, T))
27432743
{
2744+
// If this is a COM class we allocate it using malloc.
2745+
// This allows the reference counting to outlive the reference known about by the GC.
2746+
27442747
p = pureMalloc(init.length);
27452748
if (!p)
27462749
onOutOfMemoryError();

tests/dmd/fail_compilation/b19523.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ TEST_OUTPUT:
33
----
44
fail_compilation/b19523.d(13): Error: undefined identifier `SomeStruct`
55
fail_compilation/b19523.d(14): Error: function `foo` is not callable using argument types `(_error_)`
6-
fail_compilation/b19523.d(14): cannot pass argument `__lambda2` of type `_error_` to parameter `int delegate() arg`
6+
fail_compilation/b19523.d(14): cannot pass argument `__lambda_L14_C6` of type `_error_` to parameter `int delegate() arg`
77
fail_compilation/b19523.d(19): `b19523.foo(int delegate() arg)` declared here
88
----
99
*/

tests/dmd/fail_compilation/bug9631.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ TEST_OUTPUT:
6565
fail_compilation/bug9631.d(80): Error: function `f` is not callable using argument types `(int, S)`
6666
fail_compilation/bug9631.d(80): cannot pass argument `y` of type `bug9631.tem!().S` to parameter `bug9631.S s`
6767
fail_compilation/bug9631.d(79): `bug9631.arg.f(int i, S s)` declared here
68-
fail_compilation/bug9631.d(81): Error: function literal `__lambda4(S s)` is not callable using argument types `(S)`
68+
fail_compilation/bug9631.d(81): Error: function literal `__lambda_L81_C5(S s)` is not callable using argument types `(S)`
6969
fail_compilation/bug9631.d(81): cannot pass argument `x` of type `bug9631.S` to parameter `bug9631.tem!().S s`
7070
fail_compilation/bug9631.d(87): Error: constructor `bug9631.arg.A.this(S __param_0)` is not callable using argument types `(S)`
7171
fail_compilation/bug9631.d(87): cannot pass argument `S(0)` of type `bug9631.tem!().S` to parameter `bug9631.S __param_0`

tests/dmd/fail_compilation/constraints_defs.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ TEST_OUTPUT:
55
fail_compilation/constraints_defs.d(49): Error: template instance `constraints_defs.main.def!(int, 0, (a) => a)` does not match template declaration `def(T, int i = 5, alias R)()`
66
with `T = int,
77
i = 0,
8-
R = __lambda1`
8+
R = __lambda_L49_C18`
99
must satisfy the following constraint:
1010
` N!T`
1111
fail_compilation/constraints_defs.d(50): Error: template instance `imports.constraints.defa!int` does not match template declaration `defa(T, U = int)()`

0 commit comments

Comments
 (0)