www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22050] New: -betterC silent crash when compiling map


          Issue ID: 22050
           Summary: -betterC silent crash when compiling map returning
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: mipri minimaltype.com

This program fails to compile with no output from dmd:

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

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

Shell session:

$ dmd -c bclife.d || echo failed
$ dmd -betterC -c bclife.d || echo failed
$ dmd -betterC -c bclife.d -v |tail -1
import    core.internal.lifetime       

This behavior is seen also with a just-compiled devel dmd.

s/string/float/ and it's fine.

it silently crashes elsewhere with "".dup instead of to!string(n):

semantic2 bclife3
semantic3 bclife3
import    core.stdc.string     

Most other variations that I've tried hit expected betterC errors.

Jun 20 2021