www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20703] New: Segfault on missing import in template

https://issues.dlang.org/show_bug.cgi?id=20703

          Issue ID: 20703
           Summary: Segfault on missing import in template instantiation
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

The following code causes a segfault in dmd (checked with current master):

==============================
// c.d:
import stdx.sorting;

const var = sort(string.init);
==============================

==============================
// stdx/sorting.d:
import stdx.traits : Unqual;

auto sort(Range)(Range r)
{
    return Unqual!Range.init;
}

==============================

==============================
// stdx/traits.d:
template Unqual(T)
{
    import CoreUnqual;
    alias Unqual = CoreUnqual;
}
==============================

dmd c.d
stdx\traits.d(3): Error: module CoreUnqual is in file 'CoreUnqual.d' which
cannot be read
import path[0] = C:\D\dmd2\windows\bin64\..\..\src\phobos
import path[1] = C:\D\dmd2\windows\bin64\..\..\src\druntime\import
stdx\traits.d(3): Error: module CoreUnqual is in file 'CoreUnqual.d' which
cannot be read
import path[0] = C:\D\dmd2\windows\bin64\..\..\src\phobos
import path[1] = C:\D\dmd2\windows\bin64\..\..\src\druntime\import
stdx\traits.d(3): Error: module CoreUnqual is in file 'CoreUnqual.d' which
cannot be read
import path[0] = C:\D\dmd2\windows\bin64\..\..\src\phobos
import path[1] = C:\D\dmd2\windows\bin64\..\..\src\druntime\import

--
Mar 28