www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Bug 170] New: Template functions in templates missing member symbols

Date: Sat, 3 Jan 2015 03:05:23 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"


            Bug ID: 170
           Summary: Template functions in templates missing member symbols
           Product: GDC
           Version: 4.8.x
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gdc
          Assignee: ibuclaw gdcproject.org
          Reporter: obscurans gmail.com

Template functions in a template scope aren't inferring instantiations
correctly. This is a bit hard to explain so here's a MWE:

module foobar;

class bar(T) {
    void undefined_reference() {}

template foo(T) {
    bar!T foo1(T2)() if (true) body { return null; }
    bar!T foo2(T2)() { return null; }
    bar!T foo3(T2 = void)() if (true) body { return null; }
    bar!T foo4(T2 = void)() { return null; }
    void foo5(T2)(bar!T x) if (true) body {}
    void foo6(T2)(bar!T x) {}
    void foo7(T2 = void)(bar!T x) if (true) body {}
    void foo8(T2 = void)(bar!T x) {}

import foobar;

void main() {
    foo!void.foo1!void();        // succeeds
    foo!void.foo2!void();        // succeeds
    foo!void.foo3();        // succeeds
    foo!void.foo3!void();        // succeeds
    foo!void.foo4();        // succeeds
    foo!void.foo4!void();        // succeeds
//    foo!void.foo5!void(null);    // fails!
    foo!void.foo6!void(null);    // succeeds
    foo!void.foo7(null);        // succeeds
//    foo!void.foo7!void(null);    // fails!
    foo!void.foo8(null);        // succeeds
    foo!void.foo8!void(null);    // succeeds

Uncomment the failing lines, and I get (on 4.8.2) a linker error missing void

If they are in the same file nothing fails. For parameters only, it fails only
if both a template argument was given and a template constraint exists.

You are receiving this mail because:
You are watching all bug changes.
Jan 02 2015