[Issue 24547] Stack overflow in CppMangleVisitor.writeQualified

2024-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24547

Tim  changed:

   What|Removed |Added

   Keywords||C++

--


[Issue 24547] New: Stack overflow in CppMangleVisitor.writeQualified

2024-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24547

  Issue ID: 24547
   Summary: Stack overflow in CppMangleVisitor.writeQualified
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: tim.dl...@t-online.de

DMD crashes when compiling the following code:

```
extern(C++):

struct S(bool defined)
{
enum DefinedType { Defined }
}

void f(T)(S!(true).DefinedType = S!(true).DefinedType.Defined)
{
}

void main()
{
f!(int)();
}
```

A gdb backtrace repeats the following three lines:
```
#50 0x55952ab7 in CppMangleVisitor::visit(TemplateInstance*)
(this=0x7fffb848, t=0x7789a8a0) at src/dmd/cppmangle.d:2095
#51 0x559d6f8e in TemplateInstance::accept(Visitor*)
(this=0x7789a8a0, v=0x7fffb848) at src/dmd/dtemplate.d:5496
#52 0x55951b67 in
_D3dmd9cppmangle16CppMangleVisitor14writeQualifiedMFCQBz9dtemplate16TemplateInstanceMDFZvZv
(this=0x7fffb848, dg=..., t=0x7789a8a0) at src/dmd/cppmangle.d:1671
```

According to run.dlang.org it compiled until 2.083.1 and DMD crashes since
2.084.1, but I did not check if the mangling was correct, when it compiled.

--


[Issue 24531] foreach lowering fails to compile with dip1000 and std.array.array

2024-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24531

Nick Treleaven  changed:

   What|Removed |Added

 CC||n...@geany.org

--- Comment #3 from Nick Treleaven  ---
It compiles with:

import std.algorithm : filter, map;

Adding -dip1000 gives:

arrayctfe.d(14): Error: scope variable `srcs` assigned to non-scope parameter
`range` calling `arrayCtfe`
arrayctfe.d(28):which is not `scope` because of `__r115 = range`

Replacing the foreach statement with the while code in comment #0 does compile
with -dip1000.

--