Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alias to typecons.Rebindable depends on lexical order #19178

Open
dlangBugzillaToGithub opened this issue Aug 25, 2016 · 0 comments
Open

alias to typecons.Rebindable depends on lexical order #19178

dlangBugzillaToGithub opened this issue Aug 25, 2016 · 0 comments
Labels

Comments

@dlangBugzillaToGithub
Copy link

Simon Naarmann (@SimonN) reported this on 2016-08-25T09:43:01Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=16427

CC List

  • ag0aep6g

Description

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));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant