Thread overview
[Issue 24246] ICE: CTFE internal error: literal 'TypeExp' in src/dmd/ctfeexpr.d(439)
[Issue 24246] ICE: CTFE internal error
Nov 15, 2023
Iain Buclaw
Nov 15, 2023
Iain Buclaw
Nov 15, 2023
Iain Buclaw
Nov 15, 2023
Iain Buclaw
Nov 15, 2023
Iain Buclaw
Nov 15, 2023
Andrey Zherikov
Nov 15, 2023
Iain Buclaw
Nov 15, 2023
Iain Buclaw
Nov 15, 2023
Dlang Bot
November 15, 2023
https://issues.dlang.org/show_bug.cgi?id=24246

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |critical

--
November 15, 2023
https://issues.dlang.org/show_bug.cgi?id=24246

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@gdcproject.org

--- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> ---
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

--
November 15, 2023
https://issues.dlang.org/show_bug.cgi?id=24246

--- Comment #2 from Iain Buclaw <ibuclaw@gdcproject.org> ---
To work around, you're missing parentheses in the constructor call.

```
auto opBinary(string op)(ubyte other)
{
    return other ? TextStyle() : this;
}
```

--
November 15, 2023
https://issues.dlang.org/show_bug.cgi?id=24246

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|x86                         |All
                 OS|Windows                     |All

--
November 15, 2023
https://issues.dlang.org/show_bug.cgi?id=24246

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE: CTFE internal error    |ICE: CTFE internal error:
                   |                            |literal 'TypeExp' in
                   |                            |src/dmd/ctfeexpr.d(439)

--
November 15, 2023
https://issues.dlang.org/show_bug.cgi?id=24246

--- Comment #3 from Andrey Zherikov <andrey.zherikov@gmail.com> ---
Attached file is already a result of dustmite.

--
November 15, 2023
https://issues.dlang.org/show_bug.cgi?id=24246

--- Comment #4 from Iain Buclaw <ibuclaw@gdcproject.org> ---
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);

--
November 15, 2023
https://issues.dlang.org/show_bug.cgi?id=24246

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #5 from Iain Buclaw <ibuclaw@gdcproject.org> ---
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.

--
November 15, 2023
https://issues.dlang.org/show_bug.cgi?id=24246

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
@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

--