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

"cannot inline default argument" of a mixin template alias parameter #19605

Open
dlangBugzillaToGithub opened this issue Aug 11, 2019 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

dlangBugzillaToGithub commented Aug 11, 2019

Nicholas Wilson (@thewilsonator) reported this on 2019-08-11T00:50:21Z

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

Description

struct S
{
    int data;
    int pos = 5;
private:  
    mixin template auxdispatch(alias F, alias indx)
    {
        auto auxdispatch(int x = indx) //Error here
        {
            return F(x);
        }
    }
    auto dispatcher(Func...)(int a)
    {
        alias Func0 = Func[0];
        return Func0!()(a);
    }
 public:   
    void outer()
    {
        void nested()(int a)
        {
            data += a;
        }
        
        mixin auxdispatch!(nested,pos);
        auxdispatch();
        import std.stdio;
        writeln(data);
    }
}

void main()
{
    S s;
    s.outer();
}

fails with "onlineapp.d(8): Error: cannot inline default argument this.pos"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant