www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19545] New: __traits(compiles, X) false positive, further

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

          Issue ID: 19545
           Summary: __traits(compiles, X) false positive, further uses of
                    X succeed but don't link
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: john.loughran.colvin gmail.com

import std.range, std.regex;
void main()
{
    //pragma(msg, __traits(compiles,
inputRangeObject(RegexMatch!string.init)));
    inputRangeObject(RegexMatch!string.init);
}

/dlang/dmd/linux/bin64/../../src/phobos/std/range/primitives.d(2023): Error:
static assert:  "Cannot move front of a range with a postblit and an rvalue
front."
/dlang/dmd/linux/bin64/../../src/phobos/std/range/interfaces.d(379):       
instantiated from here: moveFront!(RegexMatch!string)
/dlang/dmd/linux/bin64/../../src/phobos/std/range/interfaces.d(488):       
instantiated from here: InputRangeObject!(RegexMatch!string)
onlineapp.d(5):        instantiated from here:
inputRangeObject!(RegexMatch!string)

uncomment the pragma and you get

true
/dlang/dmd/linux/bin64/../../src/phobos/std/range/interfaces.d:497: error:
undefined reference to
'_D3std5range10interfaces__T16InputRangeObjectTS3std5regex__T10RegexMatchTAyaZQrZQCb7__ClassZ'
/dlang/dmd/linux/bin64/../../src/phobos/std/range/interfaces.d:497: error:
undefined reference to
'_D3std5range10interfaces__T16InputRangeObjectTSQBt5regex__T10RegexMatchTAyaZQrZQCa6__ctorMFNfQBvZCQDsQDrQDo__TQDfTQCqZQDn'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1

--
Jan 03