www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16084] New: Linker error with interface final function

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

          Issue ID: 16084
           Summary: Linker error with interface final function calling
                    virtual function
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: jack jackstouffer.com

The following legal code fails to compile with a linker error, reduced with
dustmite:

-----------------
import std.typecons;
struct Result
{
    Nullable!(int) var;
}

interface A
{
    bool func(S)(S a);

    final void validate(Result res)
    {
        if (func(res))
            res.var = 0;
    }
}

void main() {}
-----------------

$ dmd ymd.d

Undefined symbols for architecture x86_64:
  "__D3ymd1A22__T4funcTS3ymd6ResultZ4funcMFS3ymd6ResultZb", referenced from:
      __D3ymd1A8validateMFS3ymd6ResultZv in ymd.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: /usr/bin/gcc failed with status: 1

--
May 27 2016