Bug 12549 – Immutable can't be casted when using nested pointers

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-04-08T14:12:00Z
Last change time
2014-04-08T19:43:21Z
Assigned to
nobody
Creator
jbinero

Attachments

IDFilenameSummaryContent-TypeSize
1343app.dexample filetext/x-dsrc199

Comments

Comment #0 by jbinero — 2014-04-08T14:12:22Z
Created attachment 1343 example file When using nested pointers, DMD seems to not be able to realize immutable is also constant. It'll result in errors similar to: "function app.test2 (const(char)** test2) is not callable using argument types (immutable(char)**)"
Comment #1 by andrej.mitrovich — 2014-04-08T14:24:15Z
Comment #2 by jbinero — 2014-04-08T14:29:05Z
(In reply to comment #1) > Likely dupe of https://d.puremagic.com/issues/show_bug.cgi?id=4251. See the > comment http://d.puremagic.com/issues/show_bug.cgi?id=4251#c9. That issue dates from 2 years ago, and it is marked as resolved, while this bug still occurs in the head and latest version (2.065) of DMD.
Comment #3 by jbinero — 2014-04-08T14:31:24Z
Oh I see what you meant now. But when changing a pointer you should only allow it to point at what its type tells it to, a constant character in this case! That on its own is a bug.
Comment #4 by jbinero — 2014-04-08T14:39:44Z
I see now, the poiter pointing to an immutable type can be changed to point to a const (mutable) type. *** This issue has been marked as a duplicate of issue 4251 ***
Comment #5 by k.hara.pg — 2014-04-08T19:43:21Z
This is an invalid issue, because of the issue 4251.