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

const on AliasSeq ignored #19553

Open
dlangBugzillaToGithub opened this issue Apr 8, 2019 · 3 comments
Open

const on AliasSeq ignored #19553

dlangBugzillaToGithub opened this issue Apr 8, 2019 · 3 comments

Comments

@dlangBugzillaToGithub
Copy link

Yuxuan Shui (@yshui) reported this on 2019-04-08T23:09:51Z

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

CC List

  • ag0aep6g
  • basile-z
  • Victor Porton

Description

const(AliasSeq!(int, int)) a;

pragma(msg, typeof(a));  // <- (int, int)


The compiler should probably at least generate a warning for this case.
@dlangBugzillaToGithub
Copy link
Author

ag0aep6g commented on 2019-04-08T23:17:37Z

Noteworthy:

const AliasSeq!(int, int) b;
pragma(msg, typeof(b)); /* (const(int), const(int)) */

@dlangBugzillaToGithub
Copy link
Author

simen.kjaras commented on 2019-05-05T14:39:29Z

*** Issue 19845 has been marked as a duplicate of this issue. ***

@dlangBugzillaToGithub
Copy link
Author

b2.temp commented on 2023-12-16T21:06:20Z

Not and ER, that is well a bug, according to https://dlang.org/spec/const3.html#const_type

> [...]. Each applies transitively to all subtypes.

The problem is that the DMD class `TypeTuple` (in mtype.d) does not override `.constOf`, `immutableOf()`, etc.

Tagging as accept-invalid given that

```d
alias AliasSeq(T...) = T;

const(AliasSeq!(int, int)) a;

void main()
{
    a[0] = 1;
}    
```

should be reject just like when `const` is variable storage class.

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