Comment #0 by andrey.zherikov — 2023-11-14T23:16:57Z
Created attachment 1901
Source code to reproduce the issue
Compile attached file with `dmd package.d`:
> c:\d\dmd.2.106.0-beta.1.windows\dmd2\windows\bin64\dmd.exe package.d
package.d(34): Error: CTFE internal error: literal `TextStyle`
> echo %errorlevel%
-1073741795
Errorcode is C000001D
Comment #1 by ibuclaw — 2023-11-15T14:09:25Z
The full error in debug builds is:
```
issue24246.d(34): Error: CTFE internal error: literal `TextStyle`
---
ERROR: This is a compiler bug.
Please report it via https://issues.dlang.org/enter_bug.cgi
with, preferably, a reduced, reproducible example and the information below.
DustMite (https://github.com/CyberShadow/DustMite/wiki) can help with the reduction.
---
DMD v2.106.0-beta.1-18-g65a3da148c
predefs DigitalMars LittleEndian D_Version2 all D_SIMD Posix ELFv1 linux CRuntime_Glibc CppRuntime_Gcc D_InlineAsm_X86_64 X86_64 D_LP64 D_PIC assert D_PreConditions D_PostConditions D_Invariants D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat
binary ./generated/linux/release/64/dmd
version v2.106.0-beta.1-18-g65a3da148c
config ./generated/linux/release/64/dmd.conf
DFLAGS -I./generated/linux/release/64/../../../../druntime/import -I./generated/linux/release/64/../../../../../phobos -L-L./generated/linux/release/64/../../../../../phobos/generated/linux/release/64 -L--export-dynamic -fPIC
---
core.exception.AssertError@src/dmd/ctfeexpr.d(439): Assertion failure
Comment #2 by ibuclaw — 2023-11-15T14:11:48Z
To work around, you're missing parentheses in the constructor call.
```
auto opBinary(string op)(ubyte other)
{
return other ? TextStyle() : this;
}
```
Comment #3 by andrey.zherikov — 2023-11-15T14:20:35Z
Attached file is already a result of dustmite.
Comment #4 by ibuclaw — 2023-11-15T19:31:31Z
Proper reduction of the test case.
---
auto f24246()
{
return 1;
}
auto f24246(int i)
{
return true ? int : i;
}
struct S24246
{
int field;
}
enum ice24246 = S24246(f24246.f24246);
Comment #5 by ibuclaw — 2023-11-15T19:43:03Z
Confirmed issue. As the following issues an error:
---
auto f24246(int i)
{
return int; // Error: type `int` is not an expression
}
---
That it's in a conditional expression should not prevent the same error from being given.
Comment #6 by dlang-bot — 2023-11-15T20:40:12Z
@maxhaton created dlang/dmd pull request #15818 "Fix Issue 24246 - This eliminates the ICE, stopping the bleed, but do…" fixing this issue:
- Fix Issue 24246 - This eliminates the ICE, stopping the bleed, but does not fix the underlying issue in that the type checking is faulty.
https://github.com/dlang/dmd/pull/15818
Comment #7 by robert.schadek — 2024-12-13T19:31:49Z