[Issue 24175] DIP1000 fails to determine proper lifetime for struct

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

Dennis  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||dkor...@live.nl
 Resolution|--- |INVALID

--- Comment #1 from Dennis  ---
> However, both `a` and `test` should have same lifetime and therefore this 
> code should be allowed

To communicate that, you need to add `return scope` to parameter `data`, or
make the constructor a template function so it's inferred. Otherwise the
constructor could assign the stack allocated slice to a global variable.

--


[Issue 3396] Compiler accepts call of superclass abstract method with no implementation

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

Basile-z  changed:

   What|Removed |Added

 CC||b2.t...@gmx.com
Summary|Compiler accepts call of|Compiler accepts call of
   |superclass abstract method  |superclass abstract method
   |with no implementation - is |with no implementation
   |this intended?  |

--


[Issue 24175] New: DIP1000 fails to determine proper lifetime for struct

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

  Issue ID: 24175
   Summary: DIP1000 fails to determine proper lifetime for struct
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: grimmapl...@gmail.com

Consider the code below:
```
struct A
{
this(int[] data) @safe { a = data; }
int[] a;
}

void main() @safe
{
int[3] test = [1, 2, 3];
A a = A(test);
}
```

It fails to compile with dip1000, saying:

Error: reference to local variable `test` assigned to non-scope parameter
`data` calling `this`

However, both `a` and `test` should have same lifetime and therefore this code
should be allowed

--


[Issue 22996] [ICE] Parsing at CTFE crash the compiler

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

Basile-z  changed:

   What|Removed |Added

   Keywords||CTFE

--


[Issue 19932] ICE: compiler crashes when reading ifloat/idouble as uint/ulong during CTFE

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

Basile-z  changed:

   What|Removed |Added

   Keywords||CTFE
 CC||b2.t...@gmx.com

--


[Issue 7157] Optimiser is O(n^2) w.r.t. function length

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

Basile-z  changed:

   What|Removed |Added

 CC||hoganme...@gmail.com

--- Comment #14 from Basile-z  ---
*** Issue 6401 has been marked as a duplicate of this issue. ***

--


[Issue 6401] infinite loop with -inline in gflow.c:accumaecpx

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

Basile-z  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||b2.t...@gmx.com
 Resolution|--- |DUPLICATE

--- Comment #9 from Basile-z  ---
https://issues.dlang.org/show_bug.cgi?id=19550 is resolved

*** This issue has been marked as a duplicate of issue 7157 ***

--


[Issue 21121] Optimizer slowdowns

2023-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21121
Issue 21121 depends on issue 6401, which changed state.

Issue 6401 Summary: infinite loop with -inline in gflow.c:accumaecpx
https://issues.dlang.org/show_bug.cgi?id=6401

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--


[Issue 19666] Implicit cast from static array to its .ptr not properly rejected during CTFE

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

Basile-z  changed:

   What|Removed |Added

 CC||b2.t...@gmx.com
Summary|Compiler executes illegal   |Implicit cast from static
   |instruction casting array   |array to its .ptr not
   |to struct pointer   |properly rejected during
   ||CTFE

--- Comment #3 from Basile-z  ---
my last comment is wrong, the problem is that implicit conv from static array
to its .ptr is not implemented correctly in the CTFE engine. 

The expected error happens when doing the cast explicitly:

```d
struct StoreAny {
ubyte[16] store;
this(T)(T value) {
*(cast(T*) store.ptr) = value;
}
}

struct SomeStruct {}
enum StoreAny someEnum = StoreAny(SomeStruct()); 
```

> a.d:4:20: Error: reinterpreting cast from `ubyte*` to `SomeStruct*` is not 
> supported in CTFE

--


[Issue 15575] partial initialization of a union member causes wrong diagnostic during CTFE

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

Basile-z  changed:

   What|Removed |Added

   Keywords|ice |CTFE, rejects-valid
 CC||b2.t...@gmx.com
Summary|Wrong value for static  |partial initialization of a
   |immutable struct with union |union member causes wrong
   ||diagnostic during CTFE

--- Comment #3 from Basile-z  ---
updated test case:

```
struct B15575 {
union {
ubyte[2] a;
struct {
ubyte b;
ubyte c;
}
}

this(ubyte b) {
if (b)
this.a[0] = b;
else
this.b = b;
this.c = 0;
}
}

void main()
{
auto a = B15575(7).a; // run-time OK
pragma(msg, B15575(7).a); // CTFE NG
} 
```

--


[Issue 24174] [CTFE] goto within with statements & catch blocks cause a infinite loop

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

Dlang Bot  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #2 from Dlang Bot  ---
dlang/dmd pull request #15651 "Fix issue 24174 - [CTFE] goto within with
statements & catch blocks cause a infinite loop" was merged into master:

- 62c233919c06e4d2aa79449f83b1bd52d84b0a11 by Mai-Lapyst:
  Fix issue 24174 - [CTFE] goto within with statements & catch blocks cause a
infinite loop

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

--