D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20119 - "cannot inline default argument" of a mixin template alias parameter
Summary: "cannot inline default argument" of a mixin template alias parameter
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2019-08-11 00:50 UTC by Nicholas Wilson
Modified: 2024-12-13 19:04 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Nicholas Wilson 2019-08-11 00:50:21 UTC
---
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"
Comment 1 dlangBugzillaToGithub 2024-12-13 19:04:49 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

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

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