[Issue 23967] 12.14 Array Properties - capacity description

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23967

--- Comment #1 from Franciszek Czekala  ---
However, when you shrink the array a like this: a=a[0..$-1], the subsequent
capacity will show as zero, so there is inconsistency here which looks like a
bug to me.

Example:
int[] a = new int[10];
// a.length == 10, a.capacity == 11
a = a[0..$-1];
// a.length == 9, a.capacity == 0 (???)

Either capacity represents the total number of elements that an array can hold
or it represents the amount of elements that can be appended. As can be seen
above it can be either the former or the latter depending on the context which
seems definitely wrong.

--


[Issue 23967] New: 12.14 Array Properties - capacity description

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23967

  Issue ID: 23967
   Summary: 12.14 Array Properties - capacity description
   Product: D
   Version: D2
  Hardware: x86
OS: Windows
Status: NEW
  Severity: minor
  Priority: P1
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: h...@valentimex.com

It says: .capacity  Returns the number of elements that can be appended to
the array without reallocating.

This is wrong as the number of elements that can be appended without
reallocating is a.capacity - a.length (as described in 12.14.2).

--


[Issue 4071] Missing support to share memory and objects between DLLs and executable

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4071

--- Comment #14 from Walter Bright  ---
Rainer's add options -exportall and -sharedlib to dmd 

Index: backend/cdef.h
===
--- backend/cdef.h  (revision 431)
+++ backend/cdef.h  (working copy)
@@ -675,6 +675,7 @@
 #   define WFsaveds  0x2000 // use push/pop DS for far functions
 #   define WFdsnedgroup 0x4000  // DS != DGROUP
 #   define WFexe 0x8000 // generating code for Windows EXE
+#  define WFexpall  0x1// generate export definition for all
symbols

 char inline8087;/* 0:   emulator
1:   IEEE 754 inline 8087 code
Index: backend/cgobj.c
===
--- backend/cgobj.c (revision 431)
+++ backend/cgobj.c (working copy)
@@ -2285,16 +2285,20 @@
 {   char *coment;
 size_t len;

-coment = (char *) alloca(4 + 1 + (IDMAX + IDOHD) + 1); // allow extra byte
for mangling
+coment = (char *) alloca(4 + 1 + (2*IDMAX + IDOHD) + 1); // allow extra
byte for mangling
 len = obj_mangle(s,[4]);
 assert(len <= IDMAX + IDOHD);
-coment[1] = 0xA0;   // comment class
-coment[2] = 2;  // why??? who knows
-if (argsize >= 64)  // we only have a 5 bit field
-argsize = 0;// hope we don't need callgate
-coment[3] = (argsize + 1) >> 1; // # words on stack
-coment[4 + len] = 0;// no internal name
-objrecord(COMENT,coment,4 + len + 1);   // module name record
+coment[0] = 0x80;  // comment type (no purge bit
set)
+coment[1] = 0xA0;  // comment class
+coment[2] = 2; // why??? who knows
+if (argsize >= 64) // we only have a 5 bit field
+   argsize = 0;// hope we don't need callgate
+coment[3] = (argsize + 1) >> 1;// # words on stack
+if(config.wflags & WFexpall)
+   len += obj_mangle(s,coment+4+len);  // workaround for linker
inconsistently removing first char
+else
+   coment[4 + len++] = 0;  // no internal name
+objrecord(COMENT,coment,4 + len);  // module name record
 }

 /
Index: backend/out.c
===
--- backend/out.c   (revision 431)
+++ backend/out.c   (working copy)
@@ -141,6 +141,8 @@
 ty = s->ty();
 if (ty & mTYexport && config.wflags & WFexpdef && s->Sclass != SCstatic)
 obj_export(s,0);// export data definition
+else if(config.wflags & WFexpall && type_mangle(s->Stype))
+   obj_export(s,0);// export data definition
 for (dt = dtstart; dt; dt = dt->DTnext)
 {
 //printf("dt = x%p, dt = %d\n",dt,dt->dt);
@@ -1436,6 +1438,8 @@
 !(sfunc->Sclass == SCinline && !(config.flags2 & CFG2comdat)) &&
 sfunc->ty() & mTYexport)
 obj_export(sfunc,Poffset);  // export function definition
+else if(config.wflags & WFexpall && type_mangle(sfunc->Stype))
+   obj_export(sfunc,Poffset);  // export function definition

 if (config.fulltypes)
 cv_func(sfunc); // debug info for function
Index: glue.c
===
--- glue.c  (revision 431)
+++ glue.c  (working copy)
@@ -610,8 +610,11 @@
 else if (strcmp(s->Sident, "main") == 0 && linkage == LINKc)
 {
 #if TARGET_WINDOS
-objextdef("__acrtused_con");// bring in C startup code
-obj_includelib("snn.lib");  // bring in C runtime library
+   objextdef("__acrtused_con");// bring in C startup code
+   if(global.params.sharedlib)
+   obj_includelib("snn_shared.lib");   // bring in shared part
of C runtime library
+   else
+   obj_includelib("snn.lib");  // bring in C runtime
library
 #endif
 s->Sclass = SCglobal;
 }
Index: mars.c
===
--- mars.c  (revision 431)
+++ mars.c  (working copy)
@@ -165,7 +165,7 @@
 #endif
 fprintf(stdmsg, "\n");
 fflush(stdmsg);
-//halt();
+halt();
 }
 global.errors++;
 }
@@ -216,7 +216,7 @@
  */
 void halt()
 {
-#ifdef DEBUG
+#if 0 //def DEBUG
 *(char*)0=0;
 #endif
 }
@@ -254,6 +254,7 @@
   -debuglib=nameset symbolic debug library to name\n\
   -defaultlib=name  set default library to name\n\
   -deps=filename write module dependencies to filename\n%s\
+  -exportall export any suitable public symbol\n\
   -g add symbolic debug info\n\
   -gcadd symbolic debug 

[Issue 23959] [REG2.101.0] Copying arrays of types with postblits from varargs broken

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23959

--- Comment #1 from Dlang Bot  ---
@teodutu created dlang/dmd pull request #15295 "Move lowerings to
`_d_array{setassign,assign_{l,r}}` to a `LoweredAssignExp` AST node" mentioning
this issue:

- Move lowerings to `_d_array{setassign,assign_{l,r}}` to a `LoweredAssignExp`
AST node

  This PR does the following:
  - uses a `LoweredAssignExp` node for assignmets that lower to
  `_d_arrayassign_{l,r}`
  - removes the code in `dinterpret.d` that recreates the original
  `AssigExp`
  - simplifies `isArrayConstructionOrAssign()` to just
`isArrayConstruction()` since assignments are now handled by a separate
  AST node
  - fixes issue 23959

  Signed-off-by: Teodor Dutu 

https://github.com/dlang/dmd/pull/15295

--


[Issue 23500] std.traits.getUDAs not working properly for overloads

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23500

--- Comment #3 from johanenge...@weka.io ---
Failing testcase with templates:

```
module test;
import std.traits;
@("gigi")
void fun() {}
@("mimi")
void fun(int) {}
void fun()(int, ulong) {}

void main()
{
static foreach (t; __traits(getOverloads, test, "fun"))
pragma(msg, hasUDA!(t, "gigi"));
}
```

--


[Issue 23966] [REG2.102] Cannot use traits(getAttributes) with overloaded template

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23966

johanenge...@weka.io changed:

   What|Removed |Added

   Keywords||industry, rejects-valid

--


[Issue 23500] std.traits.getUDAs not working properly for overloads

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23500

johanenge...@weka.io changed:

   What|Removed |Added

 CC||johanenge...@weka.io

--- Comment #2 from johanenge...@weka.io ---
Related bug https://issues.dlang.org/show_bug.cgi?id=23966

--


[Issue 23966] New: [REG2.102] Cannot use traits(getAttributes) with overloaded template

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23966

  Issue ID: 23966
   Summary: [REG2.102] Cannot use traits(getAttributes) with
overloaded template
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: johanenge...@weka.io

Testcase:
```
module test;

@("gigi")
void fun() {}
@("mimi")
void fun(int) {}
void fun()(int, ulong) {}

void main()
{
static foreach (t; __traits(getOverloads, test, "fun"))
static foreach(attr; __traits(getAttributes, t))
pragma(msg, attr);

}
```

This no longer works with dlang 2.102, even though the release notes say that
this is correct code.
https://dlang.org/changelog/2.102.0.html#dmd.deprecate-getAttributes-overloadSet
It errors on the fun()(...) template.

--


[Issue 23965] New: [REG2.101.0] Appending deprecated structs in deprecated function causes deprecation message

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23965

  Issue ID: 23965
   Summary: [REG2.101.0] Appending deprecated structs in
deprecated function causes deprecation message
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: rejects-valid
  Severity: regression
  Priority: P3
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: dlang-bugzi...@thecybershadow.net

Generally, deprecated code can use other deprecated code without additional
messages. This allows to bulk-deprecate interdependent code in a library,
making it possible to allow the library to compile with no deprecation
messages, but only causing them if something (non-deprecated) accesses the
deprecated declarations.

However, the following case has regressed in 2.101:

 test.d ///
deprecated:

struct S {}

void fun()
{
S[] arr;
arr ~= S();
}
///

Before it compiled with no errors or messages.

Now, with -de, it fails with:

/path/to/dmd.linux/dmd2/linux/bin64/../../src/druntime/import/core/internal/array/appending.d(#):
Deprecation: struct `test.S` is deprecated
test.d(8):instantiated from here: `_d_arrayappendcTXImpl!(S[], S)`
/path/to/dmd.linux/dmd2/linux/bin64/../../src/druntime/import/core/internal/array/utils.d(#):
Deprecation: struct `test.S` is deprecated
/path/to/dmd.linux/dmd2/linux/bin64/../../src/druntime/import/core/internal/array/appending.d(#):
   instantiated from here: `_d_HookTraceImpl!(S[], _d_arrayappendcTX,
"Cannot append to array if compiling without support for runtime type
information!")`
test.d(8):instantiated from here: `_d_arrayappendcTXImpl!(S[], S)`

Introduced in https://github.com/dlang/dmd/pull/13495.

--


[Issue 23964] New: [REG2.102] inccorect error opAssign cannot be used ... @disable

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23964

  Issue ID: 23964
   Summary: [REG2.102] inccorect error opAssign cannot be used ...
@disable
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: johanenge...@weka.io

Requires `-de` compile flag.

Testcase:
```
ulong foo() {
return 1;
}

void compileCheck(const(ClusterInfoJohan) src, ClusterInfoJohan tgt) {
tgt = src;
}

struct ClusterInfoJohan {
UUID guid;

ulong oiuoi = 512;

ulong asdasdasd = {
foo();
return 1;
}();
}

struct UUID {
@safe @nogc
opAssign(UUID) { }
}
```

`dmd -de -o- test.d` gives:
test.d(6): Error: generated function `test.ClusterInfoJohan.opAssign` cannot be
used because it is annotated with `@disable`

Compiles fine with DMD 2.101 or older.

Digger says it is caused by this commit:
9fc7c8ff643dbc88f84d95eb8e5b8956bcd29edb
https://github.com/dlang/dmd/pull/14483

--


[Issue 23964] [REG2.102] inccorect error opAssign cannot be used ... @disable

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23964

johanenge...@weka.io changed:

   What|Removed |Added

   Keywords||industry, rejects-valid

--


[Issue 23963] Illegal instruction / segfault with -preview=dip1021

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23963

Luís Ferreira  changed:

   What|Removed |Added

 CC||cont...@lsferreira.net
Summary|Illegal instruction /   |Illegal instruction /
   |segfalult with  |segfault with
   |-preview=dip1021|-preview=dip1021

--


[Issue 23959] [REG2.101.0] Copying arrays of types with postblits from varargs broken

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23959

Teodor Dutu  changed:

   What|Removed |Added

 CC||teodor.d...@gmail.com
   Assignee|nob...@puremagic.com|teodor.d...@gmail.com

--


[Issue 23963] Illegal instruction / segfalult with -preview=dip1021

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23963

--- Comment #2 from Witold Baryluk  ---
First source code (in original top comment), produces different back trace in
gdb.

Providing for completeness

Program received signal SIGILL, Illegal instruction.
0x5589e0bd in dmd.dmangle.mangleParameter(dmd.mtype.Parameter,
dmd.common.outbuffer.OutBuffer*, ref dmd.dmangle.Backref) ()
(gdb) bt
#0  0x5589e0bd in dmd.dmangle.mangleParameter(dmd.mtype.Parameter,
dmd.common.outbuffer.OutBuffer*, ref dmd.dmangle.Backref) ()
#1  0x5589f0b3 in dmd.dmangle.mangleFuncType(dmd.mtype.TypeFunction,
dmd.mtype.TypeFunction, ubyte, dmd.mtype.Type, dmd.common.outbuffer.OutBuffer*,
ref dmd.dmangle.Backref).__foreachbody8(ulong, dmd.mtype.Parameter) ()
#2  0x5566d5bc in dmd.mtype.Parameter._foreachImpl(scope int(ulong,
dmd.mtype.Parameter, ulong, dmd.mtype.Parameter) delegate, ulong,
dmd.mtype.Parameter, ref ulong, dmd.mtype.Parameter) ()
#3  0x5566d3fc in dmd.dmangle.mangleFuncType(dmd.mtype.TypeFunction,
dmd.mtype.TypeFunction, ubyte, dmd.mtype.Type, dmd.common.outbuffer.OutBuffer*,
ref dmd.dmangle.Backref) ()
#4  0x557e8dfb in Mangler::mangleDecl(Declaration*) ()
#5  0x557e80fb in toSymbol::ToSymbol::visit(FuncDeclaration*) ()
#6  0x557f9c00 in dmd.e2ir.toElem(dmd.expression.Expression,
dmd.toir.IRState*).visitSymbol(dmd.expression.SymbolExp) ()
#7  0x557f40b4 in toElem(Expression*, IRState*) ()
#8  0x558024f9 in dmd.e2ir.toElem(dmd.expression.Expression,
dmd.toir.IRState*).visitCall(dmd.expression.CallExp) ()
#9  0x557f454a in toElem(Expression*, IRState*) ()
#10 0x557f3bbc in dmd.s2ir.Statement_toIR(dmd.statement.Statement,
dmd.toir.IRState*,
dmd.stmtstate.StmtState!(dmd.backend.cc.block).StmtState*).visitExp(dmd.statement.ExpStatement)
()
#11 0x557ec82a in dmd.s2ir.Statement_toIR(dmd.statement.Statement,
dmd.toir.IRState*,
dmd.stmtstate.StmtState!(dmd.backend.cc.block).StmtState*).visit.VisitStatement(dmd.statement.Statement)
()
#12 0x557ec916 in dmd.s2ir.Statement_toIR(dmd.statement.Statement,
dmd.toir.IRState*,
dmd.stmtstate.StmtState!(dmd.backend.cc.block).StmtState*).visit.VisitStatement(dmd.statement.Statement)
()
#13 0x557ee9ea in dmd.s2ir.Statement_toIR(dmd.statement.Statement,
dmd.toir.IRState*,
dmd.stmtstate.StmtState!(dmd.backend.cc.block).StmtState*).visit.VisitStatement(dmd.statement.Statement)
()
#14 0x557ec82a in dmd.s2ir.Statement_toIR(dmd.statement.Statement,
dmd.toir.IRState*,
dmd.stmtstate.StmtState!(dmd.backend.cc.block).StmtState*).visit.VisitStatement(dmd.statement.Statement)
()
#15 0x557ec82a in dmd.s2ir.Statement_toIR(dmd.statement.Statement,
dmd.toir.IRState*,
dmd.stmtstate.StmtState!(dmd.backend.cc.block).StmtState*).visit.VisitStatement(dmd.statement.Statement)
()
#16 0x557d2091 in toObjFile::ToObjFile::visit(FuncDeclaration*) ()
#17 0x557cdf81 in toObjFile::ToObjFile::visit(TemplateInstance*) ()
#18 0x558d688e in genObjFile(Module*, bool) ()
#19 0x558d3392 in dmd.glue.generateCodeAndWrite(dmd.dmodule.Module[],
const(char)*[], const(char)[], const(char)[], bool, bool, bool, bool, bool) ()
#20 0x558f5e08 in dmd.mars.tryMain(ulong, const(char)**, ref
dmd.globals.Param) ()
#21 0x558ff801 in D main ()

--


[Issue 23963] Illegal instruction / segfalult with -preview=dip1021

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23963

Witold Baryluk  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code

--


[Issue 23963] Illegal instruction / segfalult with -preview=dip1021

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23963

Witold Baryluk  changed:

   What|Removed |Added

   Severity|enhancement |major

--


[Issue 23963] Illegal instruction / segfalult with -preview=dip1021

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23963

--- Comment #1 from Witold Baryluk  ---
Minimized futher:

ulong richards() {
struct task {}
task* findtcb(int id) {
  task* t ;
  import std.stdio ;
  writefln!"%d"(id);
  return t;
}
return 1;
}



causes segfault:

Program received signal SIGILL, Illegal instruction.
0x55666c60 in ParseTimeVisitor::visit(Dsymbol*) ()
(gdb) bt
#0  0x55666c60 in ParseTimeVisitor::visit(Dsymbol*) ()
#1  0x558286d1 in
dmd.dinterpret.interpretRegion(dmd.expression.Expression,
dmd.dinterpret.InterState*, dmd.dinterpret.CTFEGoal) ()
#2  0x5581e425 in Interpreter::visit(ArrayLiteralExp*) ()
#3  0x558286d1 in
dmd.dinterpret.interpretRegion(dmd.expression.Expression,
dmd.dinterpret.InterState*, dmd.dinterpret.CTFEGoal) ()
#4  0x55823929 in Interpreter::visit(StructLiteralExp*) ()
#5  0x5568a426 in
dmd.dinterpret.ctfeInterpret(dmd.expression.Expression) ()
#6  0x556ccdee in dmd.initsem.initializerSemantic(dmd.init.Initializer,
dmd.dscope.Scope*, ref dmd.mtype.Type,
dmd.init.NeedInterpret).visitExp(dmd.init.ExpInitializer) ()
#7  0x556db179 in initializerSemantic(Initializer*, Scope*, Type*&,
NeedInterpret) ()
#8  0x557b7ed6 in Semantic2Visitor::visit(VarDeclaration*) ()
#9  0x557b689b in Semantic2Visitor::visit(AttribDeclaration*) ()
#10 0x557b689b in Semantic2Visitor::visit(AttribDeclaration*) ()
#11 0x557b893a in Semantic2Visitor::visit(Module*) ()
#12 0x557b67e9 in Semantic2Visitor::visit(Import*) ()
#13 0x556e0c42 in Semantic3Visitor::visit(Module*) ()
#14 0x558f58db in dmd.mars.tryMain(ulong, const(char)**, ref
dmd.globals.Param) ()
#15 0x558ff801 in D main ()

--


[Issue 23963] New: Illegal instruction / segfalult with -preview=dip1021

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23963

  Issue ID: 23963
   Summary: Illegal instruction / segfalult with -preview=dip1021
   Product: D
   Version: D2
  Hardware: x86
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: witold.barylu...@gmail.com

Created attachment 1879
  --> https://issues.dlang.org/attachment.cgi?id=1879=edit
Minimized with dustmite

dmd v2.104.0, Linux 64-bit


ulong richards() {
struct task {
  }

  int qpktcount = 0;
  int holdcount ;
  task* findtcb(int id) {
  task* t ;

import std.stdio ;
writefln!"\nBad task id %d"(id);
  return t;
  }

  return qpktcount ;
}



$ dmd -c -preview=dip1021 richards.reduced/richards.d 
Illegal instruction (core dumped)
$

--


[Issue 23962] New: Please move dub and dustmite to separate deb package

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23962

  Issue ID: 23962
   Summary: Please move dub and dustmite to separate deb package
   Product: D
   Version: D2
  Hardware: x86
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: installer
  Assignee: nob...@puremagic.com
  Reporter: witold.barylu...@gmail.com

dustmite and dub are packages already in Debian and Ubuntu, and I often have
them installed together with gdc, ldc2.

When installing dmd deb from dlang website, they cause conflicts, requiring me
to uninstall dustmite and dub first.

This is very annoying, and makes testing different versions difficult.

Would be better to split dub and dustmite into own packages, and make them
recommend dmd (but not require!).

root@debian# dpkg -i dmd_2.104.0-0_amd64.deb 
Selecting previously unselected package dmd.
(Reading database ... 1451549 files and directories currently installed.)
Preparing to unpack dmd_2.104.0-0_amd64.deb ...
Unpacking dmd (2.104.0-0) ...
dpkg: error processing archive dmd_2.104.0-0_amd64.deb (--install):
 trying to overwrite '/usr/bin/dub', which is also in package dub 1.27.0-3
Errors were encountered while processing:
 dmd_2.104.0-0_amd64.deb
root@debian#


root@debian# apt purge dub
...
root@debian#


root@debian# dpkg -i dmd_2.104.0-0_amd64.deb 
(Reading database ... 1451516 files and directories currently installed.)
Preparing to unpack dmd_2.104.0-0_amd64.deb ...
Unpacking dmd (2.104.0-0) ...
dpkg: error processing archive dmd_2.104.0-0_amd64.deb (--install):
 trying to overwrite '/usr/bin/dustmite', which is also in package dustmite
0.0.430-2
Errors were encountered while processing:
 dmd_2.104.0-0_amd64.deb
root@debian#


root@debian# apt purge dustmite
...
root@debian#


root@debian# dpkg -i dmd_2.104.0-0_amd64.deb 
(Reading database ... 1451511 files and directories currently installed.)
Preparing to unpack dmd_2.104.0-0_amd64.deb ...
Unpacking dmd (2.104.0-0) ...
Setting up dmd (2.104.0-0) ...
Processing triggers for mate-menus (1.26.0-3) ...
Processing triggers for gnome-menus (3.36.0-1.1) ...
Processing triggers for desktop-file-utils (0.26-1) ...
Processing triggers for bamfdaemon (0.5.6+repack-1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mailcap (3.70+nmu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for shared-mime-info (2.2-1) ...
root@debian#

Finally.

(No idea why so many triggeres are triggered)

As of rdmd and ddemangle I do not have opinions, as they do not cause issues
(yet).

--


[Issue 23961] New: Overload set created using selective imports causes declarations to conflict with themselves

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23961

  Issue ID: 23961
   Summary: Overload set created using selective imports causes
declarations to conflict with themselves
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: dlang-bugzi...@thecybershadow.net

/ a.d /
void fun(int v) {}
/ b.d /
void fun(string v) {}
/ c.d /
public import a : fun;
private import b : fun;
 test.d ///
import a;
import c;

void main()
{
fun(1);
}
///

Compiler says:

test.d(6): Error: `fun` matches conflicting symbols:
a.d(1):function `a.fun`
a.d(1):function `a.fun`

--


[Issue 23960] New: opApply and opApplyReverse should work with named mixin templates in aggregates

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23960

  Issue ID: 23960
   Summary: opApply and opApplyReverse should work with named
mixin templates in aggregates
   Product: D
   Version: D2
  Hardware: x86
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: witold.barylu...@gmail.com

https://godbolt.org/z/9qcGnWz8G

template M(int value) {
  int opApply(scope int delegate(ref int i) dg) {
int v = value;
return dg(v);
  }
}

struct S {
  mixin M!5 m1;
  mixin M!6 m2;
}

void main() {
  import std.stdio : writefln;
  S s;
  foreach (i; s.m1) {
writefln("%d", i);
  }
}

should compile and print 5.

But it does not compile:

dmd 2.094:

(16): Error: expression has no value
Compiler returned: 1


gdc trunk (14.0.0 20230530):

 :16:3: error: invalid 'foreach' aggregate 's.mixin M!5 m1;
   ' of type 'void'
   16 |   foreach (i; s.m1) {
  |   ^
Compiler returned: 1



I discovered this problem when implementing intrusive circular double-linked
list, which I have two per Node (each node is a member of two intrusive
circular double-linked lists, each with prev and next pointers), where I wanted
to use opApply and opApplyReverse to traverse each list independently on
demand. I am implementation DLX algorithm (Knuth's Algorithm X brute force
depth-first backtracking algorithm for finding solutions to exact cover problem
using dancing links technique).

For opApply, it can be worked around using a delegate:

void main() {
  import std.stdio : writefln;
  S s;
  foreach (i; ) {
writefln("%d", i);
  }
}

but one cannot use `foreach_revserse` on delegates, instead one needs to use
`foreach` with `` which is less readable and restricts
usage. It also does not work well if there are many opApply and/or
opApplyReverse overloads, possibly templated, as then one cannot form delegate
without explicit instantiation.

Of course if there is only one unnamed mixin, it should be possible to still
use it via class/struct scope:

foreach (i; s),   which will automatically find opApply

and if there are multiple, either ambiguity reported, or aliases uses to
provide an overload set. (This is already implemented in current D version).

--


[Issue 6019] Phobos imports in autogenerated .di header files break implicit linking with DLLs

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6019

--- Comment #13 from Walter Bright  ---
(In reply to Andrej Mitrovic from comment #1)
> http://d-programming-language.org/dll.html

Now https://wiki.dlang.org/Win32_DLLs_in_D

--


[Issue 19784] DLL in BetterC mode - Symbol Undefined __acrtused_dll

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19784

Walter Bright  changed:

   What|Removed |Added

   Keywords||dll

--


[Issue 23442] DMD DLL GC bug when calling a function from an interface that creates a new object

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23442

Walter Bright  changed:

   What|Removed |Added

   Keywords||dll
 CC||bugzi...@digitalmars.com

--


[Issue 12443] Allow passing DLLs directly to DMD to avoid the need for creating import libraries

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12443

Walter Bright  changed:

   What|Removed |Added

   Keywords||dll
 CC||bugzi...@digitalmars.com

--


[Issue 15834] Import of std.stdio (std.stdiobase) in dll fails

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15834

Walter Bright  changed:

   What|Removed |Added

   Keywords||dll
 CC||bugzi...@digitalmars.com

--


[Issue 20430] [Regression 2.089.0] DLL Runtime.terminate() hangs

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20430

Walter Bright  changed:

   What|Removed |Added

   Keywords||dll
 CC||bugzi...@digitalmars.com

--


[Issue 20390] Add llvm-dlltool.exe to dmd windows release?

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20390

Walter Bright  changed:

   What|Removed |Added

   Keywords||dll
 CC||bugzi...@digitalmars.com

--


[Issue 22335] Exporting variables from DLLs is unusable

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22335

Walter Bright  changed:

   What|Removed |Added

   Keywords||dll

--


[Issue 22181] No stack trace if usage of SimpleDllMain in static linked DLL

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22181

Walter Bright  changed:

   What|Removed |Added

   Keywords||dll
 CC||bugzi...@digitalmars.com

--


[Issue 22335] Exporting variables from DLLs is unusable

2023-06-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22335

Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WORKSFORME

--- Comment #3 from Walter Bright  ---
The current master emits this:

---
// D import file generated from 'dll.d'
module dll;
export extern __gshared int x;
extern (Windows) int DllMain(void*, uint, void*);
---

And your example is now working!

--