Bug 5473 – Members of const-qualified classes are not const themselves.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-01-21T16:05:00Z
Last change time
2012-04-23T15:21:42Z
Keywords
pull
Assigned to
nobody
Creator
eatingstaples

Attachments

IDFilenameSummaryContent-TypeSize
875main.dCode demonstrating the issueapplication/octet-stream271

Comments

Comment #0 by eatingstaples — 2011-01-21T16:05:06Z
Created attachment 875 Code demonstrating the issue An object typed as const will have const members, and a class declared as const will have const members, but a class typed as const does not have const members.
Comment #1 by lovelydear — 2012-04-22T15:28:33Z
The example code in attachment is: import std.stdio; class A { int b; } void main() { const A a = new A; writeln(typeof(a).stringof); // const(A) writeln(typeof(a.b).stringof); // const(int) writeln((const A).stringof); // const(A) writeln(typeof((const A).b).stringof); // int, should be const(int) }
Comment #2 by k.hara.pg — 2012-04-23T10:34:46Z
Comment #3 by github-bugzilla — 2012-04-23T14:54:31Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/94c3a15d6b267ca7ad314482813dfa74e4b55b3f fix Issue 5473 - Members of const-qualified classes are not const themselves https://github.com/D-Programming-Language/dmd/commit/e2c9bfa15882994a4fef9f20532797d42e887379 Merge pull request #903 from 9rnsr/fix5473 Issue 5473 - Members of const-qualified classes are not const themselves