Skip to content

Phobos 3 build broken due to recent changes #21258

@jmdavis

Description

@jmdavis

In the Phobos repo, we currently have build_v3.d as a build script for Phobos v3, and running ./build_v3.d unittest now fails with

DMD64 D Compiler v2.111.0-139-gbc3c423fd7
Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved written by Walter Bright

Source files:
/home/jmdavis/Programming/github/phobos/phobos/sys/traits.d
/home/jmdavis/Programming/github/phobos/phobos/sys/meta.d
/home/jmdavis/Programming/github/phobos/phobos/sys/compiler.d
/home/jmdavis/Programming/github/phobos/phobos/sys/system.d
---
ERROR: This is a compiler bug.
Please report it via https://github.com/dlang/dmd/issues
with, preferably, a reduced, reproducible example and the information below.
DustMite (https://github.com/CyberShadow/DustMite/wiki) can help with the reduction.
---
DMD v2.111.0-139-gbc3c423fd7
predefs   DigitalMars LittleEndian D_Version2 all D_SIMD Posix ELFv1 FreeBSD FreeBSD_14 CppRuntime_LLVM CppRuntime_Clang D_InlineAsm_X86_64 X86_64 D_LP64 D_PIC unittest assert D_PreConditions D_PostConditions D_Invariants D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat
binary    dmd
version   v2.111.0-139-gbc3c423fd7
config    /usr/local/bin/dmd.conf
DFLAGS    -I/usr/local/include/dmd -L-L/usr/local/lib -L--export-dynamic -fPIC
---
core.exception.AssertError@src/dmd/typinf.d(174): Assertion failure
----------------
??:? object.Throwable.TraceInfo core.runtime.defaultTraceHandler(void*) [0x79a832]

Build failed.

It appears that it's not the build script that's failing per se but the building that it's doing. And so dustmiting that gives

alias AliasSeq(TList...) = TList;

void main()
{
    foreach (T; AliasSeq!(char[int]))
        enum E { a = T, }
}

which shouldn't compile given that it would mean trying to initialize an enum value with a type, but either way, it shouldn't cause the compiler to print out an assertion failure. And compiling that version spits out a similar error

---
ERROR: This is a compiler bug.
Please report it via https://github.com/dlang/dmd/issues
with, preferably, a reduced, reproducible example and the information below.
DustMite (https://github.com/CyberShadow/DustMite/wiki) can help with the reduction.
---
DMD v2.110.0-rc.1-711-g7496f54fc4
predefs   DigitalMars LittleEndian D_Version2 all D_SIMD Posix ELFv1 FreeBSD FreeBSD_14 CppRuntime_LLVM CppRuntime_Clang 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    dmd
version   v2.110.0-rc.1-711-g7496f54fc4
config    /usr/local/bin/dmd.conf
DFLAGS    -I/usr/local/include/dmd -L-L/usr/local/lib -L--export-dynamic -fPIC
---
core.exception.AssertError@src/dmd/typinf.d(174): Assertion failure
----------------
??:? object.Throwable.TraceInfo core.runtime.defaultTraceHandler(void*) [0x7939e2]

Based on bisecting the problem, it looks like this commit is the issue

commit 7d6fff7bcf407e4b6794fa614e2ce280d2100165 (HEAD)
Author: Rainer <r.sagitario@gmx.de>
Date:   Thu Feb 13 23:01:48 2025 +0100

    Fix issue #17503 - Associative Arrays improperly register a GC-allocated TypeInfo for element cleanup
    
    - let the compiler generate type info for the AA Entry and add it to TypeInfo_AssociativeArray
    - strip modifiers for index and next in TypeInfo_AssociativeArray to make it agnostic to changes by the glue layer

So, it would be this PR: #20863

Prior to that commit, the Phobos 3 build worked, and compiling the reduced exampled prints out

foo.d(6): Error: non-constant expression `E`
        enum E { a = T, }
                     ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions