https://issues.dlang.org/show_bug.cgi?id=22577
Issue ID: 22577 Summary: ImportC: decay of function to typedef'd const function pointer causes ICE. Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: dave287...@gmail.com The following C program triggers an ICE: --- typedef int(IntFunc)(void); int one(void){ return 1; } // Ok: // int(*const func)(void) = one // Also Ok: // IntFunc* func = one; // Also Ok: // IntFunc* const func = &one; // This causes an ICE IntFunc* const func = one; --- 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.098.0-76-g9dc7b9cea 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_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat binary generated/linux/release/64/dmd version v2.098.0-76-g9dc7b9cea config generated/linux/release/64/dmd.conf DFLAGS -Igenerated/linux/release/64/../../../../../druntime/import -Igenerated/linux/release/64/.. /../../../../phobos -L-Lgenerated/linux/release/64/../../../../../phobos/generated/linux/release/64 - L--export-dynamic -fPIC --- core.exception.AssertError@src/dmd/dcast.d(1030): Assertion failure ---------------- ??:? [0x563a6ef04c85] ??:? [0x563a6ef2d006] ??:? [0x563a6ef0d70f] ??:? [0x563a6ef03dd7] src/dmd/dcast.d:1030 [0x563a6ed83bba] src/dmd/expression.d:5261 [0x563a6ecd52d7] src/dmd/dcast.d:1475 [0x563a6ecce14b] src/dmd/expression.d:1031 [0x563a6eb3384c] src/dmd/initsem.d:426 [0x563a6ec6edbc] src/dmd/initsem.d:887 [0x563a6eba2728] src/dmd/dsymbolsem.d:1125 [0x563a6ed1675d] src/dmd/declaration.d:1637 [0x563a6ed7cb97] src/dmd/dsymbolsem.d:104 [0x563a6eb9d0d3] src/dmd/dsymbolsem.d:1428 [0x563a6ed186cf] src/dmd/dsymbolsem.d:1440 [0x563a6ed1876c] src/dmd/parsetimevisitor.d:71 [0x563a6eb34264] src/dmd/attrib.d:433 [0x563a6eda54f7] src/dmd/dsymbolsem.d:104 [0x563a6eb9d0d3] src/dmd/dsymbolsem.d:1956 [0x563a6ed1afca] src/dmd/dsymbol.d:104 [0x563a6eb2e94f] src/dmd/dsymbolsem.d:1953 [0x563a6ed1af38] src/dmd/dmodule.d:1542 [0x563a6ec5d0e7] src/dmd/dsymbolsem.d:104 [0x563a6eb9d0d3] src/dmd/mars.d:474 [0x563a6edb260e] src/dmd/mars.d:1027 [0x563a6edbbf94] ??:? [0x563a6ef0d3f7] ??:? [0x563a6ef0d2f4] ??:? [0x563a6ef0d14d] src/dmd/mars.d:983 [0x563a6edbbf38] ??:? __libc_start_main [0x7fedde2c50b2] ??:? [0x563a6eb1edfd] --