Bug 22659 – [REG master] Error: declaration '(S[2] arr = __error__;)' is not yet implemented in CTFE
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-01-08T21:40:31Z
Last change time
2022-01-20T14:37:21Z
Keywords
CTFE, diagnostic, ice-on-invalid-code, pull
Assigned to
No Owner
Creator
Iain Buclaw
Comments
Comment #0 by ibuclaw — 2022-01-08T21:40:31Z
When there is a mismatch between compiler and run-time, or the body fails to compile for whatever reason, bad errors with the new templated lowerings ensue.
This was caused by recent gagging that is now done in the front-end.
https://github.com/dlang/dmd/pull/13476
---
module object;
alias size_t = typeof(int.sizeof);
extern(C) void* memcpy(return void* s1, scope const void* s2, size_t n) pure;
Tarr1 _d_arrayctor(Tarr1 : T1[], Tarr2 : T2[], T1, T2)(scope Tarr2 from) @trusted
{
Tarr1 to;
memcpy(to.ptr, from.ptr, to.length * T1.sizeof);
*cast(size_t *)&to = from.length;
return to;
}
bool test9245()
{
struct S
{
this(this) { }
}
S[2] arr;
S[2] arr2 = arr;
return true;
}
static assert(test9245());
Comment #1 by teodor.dutu — 2022-01-10T11:32:26Z
This behaviour only happens if the user basically overrides `object._d_arrayctor` with their own hook. But function names starting with `_d_` are reserved for internal usage by the compiler. Isn't this problem overly specific to a use case that is very unlikely to happen?
Comment #2 by ibuclaw — 2022-01-10T14:07:29Z
(In reply to Teodor Dutu from comment #1)
> This behaviour only happens if the user basically overrides
> `object._d_arrayctor` with their own hook. But function names starting with
> `_d_` are reserved for internal usage by the compiler. Isn't this problem
> overly specific to a use case that is very unlikely to happen?
1. It should not be possible to ICE the compiler with any code, no matter how improbable it is to have it. An `__error__` is an internal state that should never leak out to user diagnostics.
2. This happened in all pipelines after someone raised a pull request, that's not an unusual thing to do.
Comment #3 by dlang-bot — 2022-01-20T12:43:48Z
@teodutu created dlang/dmd pull request #13555 "Fix 22659 - Do not gag semantic errors from `_d_array{,set}ctor`" fixing this issue:
- Fix Issue 22659 - Do not gag semantic errors from `_d_array{,set}ctor`
Signed-off-by: Teodor Dutu <[email protected]>
https://github.com/dlang/dmd/pull/13555
Comment #4 by dlang-bot — 2022-01-20T14:37:21Z
dlang/dmd pull request #13555 "Fix 22659 - Do not gag semantic errors from `_d_array{,set}ctor`" was merged into master:
- 3d622f6613106a5e5ddf30450bdaeab938c5ffb1 by Teodor Dutu:
Fix Issue 22659 - Do not gag semantic errors from `_d_array{,set}ctor`
Signed-off-by: Teodor Dutu <[email protected]>
https://github.com/dlang/dmd/pull/13555