www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Bug 300] New: Undefined reference to

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 gdcproject.org
          Reporter: ibuclaw 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.
Jul 21 2018