Skip to content

ICE on struct nested inside a delegate passed to template #3361

Open
@JohanEngelen

Description

@JohanEngelen

Testcase:

import std.traits;

void acceptDelegate(void delegate())
{
}

void bug()
{
    acceptDelegate({
        struct T
        {
        }

        bool b = __traits(compiles, fullyQualifiedName!T);
    });
}

ldc2 testcase.d results in:

Assertion failed: (!isaStruct(t)), function DtoBitCast, file ../gen/tollvm.cpp, line 533.
0  ldc2                     0x000000010927e5e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  ldc2                     0x000000010927ec76 SignalHandler(int) + 422
2  libsystem_platform.dylib 0x00007fff5bf3cf5a _sigtramp + 26
3  ldc2                     0x000000010a6d0728 gIR + 0
4  libsystem_c.dylib        0x00007fff5bcda1ae abort + 127
5  libsystem_c.dylib        0x00007fff5bca21ac basename_r + 0
6  ldc2                     0x0000000107378762 DtoBitCast(llvm::Value*, llvm::Type*, llvm::Twine const&) + 322
7  ldc2                     0x00000001073614c5 DtoCallFunction(Loc&, Type*, DValue*, Array<Expression*>*, llvm::Value*) + 2853
8  ldc2                     0x00000001073675b5 ToElemVisitor::call(IRState*, CallExp*, llvm::Value*) + 1157
9  ldc2                     0x000000010736c0a4 ToElemVisitor::visit(CallExp*) + 20
10 ldc2                     0x0000000107366c2a toElemDtor(Expression*) + 106
11 ldc2                     0x000000010735c569 ToIRVisitor::visit(ExpStatement*) + 329
12 ldc2                     0x000000010735c6e1 ToIRVisitor::visit(CompoundStatement*) + 289
13 ldc2                     0x0000000107355e85 Statement_toIR(Statement*, IRState*) + 37
14 ldc2                     0x000000010731a103 DtoDefineFunction(FuncDeclaration*, bool) + 5907
15 ldc2                     0x00000001072fefef Declaration_codegen(Dsymbol*) + 47
16 ldc2                     0x000000010732c826 codegenModule(IRState*, Module*) + 3382
17 ldc2                     0x00000001073b38aa ldc::CodeGenerator::emit(Module*) + 202
18 ldc2                     0x00000001073ce400 codegenModules(Array<Module*>&) + 272
19 ldc2                     0x00000001071633be mars_mainBody(Param&, Array<char const*>&, Array<char const*>&) + 5838

I've tried to minimize it further by copying the fullyQualifiedName source into the testcase, but that breaks it somehow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions