D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 16427 - alias to typecons.Rebindable depends on lexical order
Summary: alias to typecons.Rebindable depends on lexical order
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P3 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2016-08-25 09:43 UTC by Simon Naarmann
Modified: 2024-12-13 18:49 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Simon Naarmann 2016-08-25 09:43:01 UTC
DMD64 D Compiler v2.071.2-b2 on Debian 6.

This code doesn't compile:

    import std.typecons;

    alias RIA = Rebindable!(immutable(IA));
    interface IA {
        Rebindable!(immutable(IA)) f();
    }

./testinterface.d(7): Error: Rebindable!(immutable(IA)) is used as a type
/usr/include/dmd/phobos/std/typecons.d(1616): Error: template instance std.traits.isDynamicArray!(immutable(IA)) error instantiating
./testinterface.d(5):        instantiated from here: Rebindable!(immutable(IA))
/usr/include/dmd/phobos/std/typecons.d(1625): Error: mixin std.typecons.RebindableCommon!(immutable(IA), IA, Rebindable) does not match template declaration RebindableCommon(T, U, alias This) if (is(T == class) || is(T == interface) || isAssociativeArray!T)
Failed: ["dmd", "-v", "-o-", "./testinterface.d", "-I."]

===================================================================

Here are 3 variants of the above code. All compile and run perfectly.

    import std.typecons;

    alias REmpty = Rebindable!(immutable(Empty));
    interface Empty { }

    interface IA {
        Rebindable!(immutable(IA)) f();
    }
    alias RIA = Rebindable!(immutable(IA));

    class B {
        Rebindable!(immutable(B)) f() { return rebindable(new immutable B()); }
    }
    alias RB = Rebindable!(immutable(B));
Comment 1 dlangBugzillaToGithub 2024-12-13 18:49:42 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19178

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB