Thread overview
[Issue 22050] -betterC: TypeInfo in speculative template instantiation aborts compilation without error message
[Issue 22050] -betterC silent crash when compiling map returning string
Jun 20, 2021
mipri
Dec 17, 2022
Iain Buclaw
Jan 15, 2023
Walter Bright
June 20, 2021
https://issues.dlang.org/show_bug.cgi?id=22050

mipri <mipri@minimaltype.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |betterC

--
June 20, 2021
https://issues.dlang.org/show_bug.cgi?id=22050

moonlightsentinel@disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |moonlightsentinel@disroot.o
                   |                            |rg
           Hardware|x86_64                      |All
            Summary|-betterC silent crash when  |-betterC: TypeInfo in
                   |compiling map returning     |speculative template
                   |string                      |instantiation aborts
                   |                            |compilation without error
                   |                            |message
                 OS|Linux                       |All

--- Comment #1 from moonlightsentinel@disroot.org ---
DMD  doesn't actually crash but aborts the compilation because of a hidden error (TypeInfo used in dup). The error message is not printed because the instantiation occurs in a speculative context.

Reduced example:

============================================
__gshared val = __traits(compiles, to!());

void to()()
{
    auto ti = typeid(char[]);
}
============================================

dmd -c -o- -betterC -verrors=spec test.d
(spec:1) test.d(6): Error: `TypeInfo` cannot be used with -betterC

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=22050

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

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

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|---                         |WORKSFORME

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
The program:

  import std.algorithm, std.range, std.conv;

  void foo() {
    assert(2 == iota(2).map!(n => to!string(n)).length);
  }

  extern (C) void main() { foo(); }


now compiles and runs successfully with -betterC on master.

--