[Bug 300] New: Undefined reference to random.Sample!(Test).Sample.test(ulong)

gdc-bugzilla at gdcproject.org gdc-bugzilla at gdcproject.org
Sat Jul 21 08:38:34 UTC 2018


https://bugzilla.gdcproject.org/show_bug.cgi?id=300

            Bug ID: 300
           Summary: Undefined reference to
                    random.Sample!(Test).Sample.test(ulong)
           Product: GDC
           Version: development
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gdc
          Assignee: ibuclaw at gdcproject.org
          Reporter: ibuclaw at gdcproject.org

As pow() is now a CTFE-able built-in, its backend symbol is generated - calling
`needsCodegen` - before its context has completed full semantic analysis.

This means that all members of `struct Sample` are erroneously marked as not
needed, resulting in a linker error.
---
module random;

struct Sample(Range)
{
    double test(size_t remaining)
    {
        double r ;
        return r ^^ remaining;
    }
}

auto sample(Range)(Range)
{
    return Sample!(Range)();
}

void main()
{
    struct Test
    {
    }

    static assert(is( typeof(sample(Test())) == struct ));
    auto sample = sample(Test());
    sample.test(5);
}
---

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the D.gnu mailing list