www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13350] New: is(typeof(fun)) causes link error when template

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

          Issue ID: 13350
           Summary: is(typeof(fun)) causes link error when template fun
                    calls undefined reference
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: monarchdodra gmail.com

//----
auto red()()
{
    return foo();
}

static int foo();

void main(string[] args)
{
    int[] data;
    assert(is(typeof(red()))); 
}
//----
main.d:(.text._D4main8__T3redZ3redFZi+0x5): undefined reference to
`_D4main3fooFZi'
//----

This is wrong, since the program never actually needed to call foo.

Seems to only trigger on Linux, and was discovered in Phobos:
https://github.com/D-Programming-Language/phobos/pull/2431

--
Aug 21 2014