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

[AA] Cannot dup const AA #18736

Open
dlangBugzillaToGithub opened this issue Dec 11, 2013 · 3 comments
Open

[AA] Cannot dup const AA #18736

dlangBugzillaToGithub opened this issue Dec 11, 2013 · 3 comments
Labels
Druntime:AA Specific to Associative Arrays P3 Severity:normal

Comments

@dlangBugzillaToGithub
Copy link

Jerry Quinn (@jlquinn) reported this on 2013-12-11T07:02:21Z

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

CC List

Description

void foo() {
  const int[] aa = [1,2];
  int[] bb = aa.dup;		// Works

  const int[string] ia = ["a":1,"b":2];
  int[string] ib = ia.dup;	// Error
}

/home/jlquinn/dmd2/linux/bin64/dmd -c aabug.d 
aabug.d(7): Error: cannot implicitly convert expression (ia.dup()) of type const(int)[string] to int[string]

Version 2.064.2 on Debian x86_64
@dlangBugzillaToGithub
Copy link
Author

hsteoh commented on 2019-10-24T17:46:13Z

Still happens on git master (b70b154d716b681c242f7d5fb3a4cea9449d508d).

@dlangBugzillaToGithub
Copy link
Author

dlang-bot commented on 2019-10-24T18:26:16Z

@quickfur created dlang/druntime pull request #2838 "Fix issue 11725: AA.dup should return mutable AA where possible." fixing this issue:

- Fix issue 11725: AA.dup should return mutable AA where possible.
  
  Since the original AA has been duplicated, it should be safe to mutate
  the copy. No need to needlessly restrict the copy to be const too.

https://github.com/dlang/druntime/pull/2838

@dlangBugzillaToGithub
Copy link
Author

dlang-bot commented on 2024-10-09T10:42:05Z

@ntrel updated dlang/dmd pull request #16979 "Fix issue 11725: AA.dup should return mutable AA where possible" fixing this issue:

- Fix Bugzilla 11725: AA.dup should return mutable AA where possible
  
  Since the original AA has been duplicated, it should be safe to mutate
  the copy. No need to restrict the copy to be const too.

https://github.com/dlang/dmd/pull/16979

@thewilsonator thewilsonator added the Druntime:AA Specific to Associative Arrays label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Druntime:AA Specific to Associative Arrays P3 Severity:normal
Projects
None yet
Development

No branches or pull requests

2 participants