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

[REG2.072] "cannot append type const(T) to type T[]" in .dup #19409

Open
dlangBugzillaToGithub opened this issue Mar 13, 2018 · 3 comments
Open
Labels
P1 Severity:Regression PRs that fix regressions

Comments

@dlangBugzillaToGithub
Copy link

Vladimir Panteleev (@CyberShadow) reported this on 2018-03-13T15:56:49Z

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

CC List

Description

///////// test.d /////////
struct S
{
    struct T
    {
        int foo;
        int[] bar;
    }

    struct M()
    {
        T[] arr;

        this(this)
        {
            arr = arr.dup;
        }
    }

    M!() m;
}
//////////////////////////

Introduced in https://github.com/dlang/dmd/pull/5500
@dlangBugzillaToGithub
Copy link
Author

bugzilla (@WalterBright) commented on 2018-05-14T13:39:43Z

(In reply to Vladimir Panteleev from comment #0)
> Introduced in https://github.com/dlang/dmd/pull/5500

This is why I don't like 700 line PRs spread across 18 files :-(

@dlangBugzillaToGithub
Copy link
Author

dlang-bugzilla (@CyberShadow) commented on 2018-05-14T19:39:02Z

The commits are big too, but if it helped, I can bisect it down to the commit.

@dlangBugzillaToGithub
Copy link
Author

john.loughran.colvin commented on 2019-01-11T18:12:39Z

Related:

struct S
{
    string get(string key)
    {
        return key;
    }
    alias get this;
}

void main()
{
    S[] a;
    auto b = a.dup;
}

/dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4473): Error: mutable method onlineapp.S.get is not callable using a const object
/dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4473):        Consider adding const or inout to onlineapp.S.get
/dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4460): Error: template instance `object._dup!(const(S), S)` error instantiating
/dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4424):        instantiated from here: _trustedDup!(const(S), S)
onlineapp.d(13):        instantiated from here: dup!(S)


and


struct S
{
    string get(string key) const
    {
        return key;
    }
    alias get this;
}

void main()
{
    S[] a;
    auto b = a.dup;
}

/dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4473): Error: function onlineapp.S.get(string key) const is not callable using argument types () const
/dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4473):        missing argument for parameter #1: string key
/dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4460): Error: template instance `object._dup!(const(S), S)` error instantiating
/dlang/dmd/linux/bin64/../../src/druntime/import/object.d(4424):        instantiated from here: _trustedDup!(const(S), S)
onlineapp.d(13):        instantiated from here: dup!(S)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 Severity:Regression PRs that fix regressions
Projects
None yet
Development

No branches or pull requests

1 participant