← Back to index
|
Original Bugzilla link
Bug 6811 – Confusion between string* and immutable(char)*, related to AA's
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-10-13T09:43:00Z
Last change time
2011-10-13T09:49:30Z
Keywords
rejects-valid
Assigned to
nobody
Creator
dsimcha
Comments
Comment #0
by dsimcha — 2011-10-13T09:43:59Z
void doExclude(string exclude) { string[string] aa; int[] keep; foreach(int i, h; ["a", "b"]) { auto ptr = h in aa; pragma(msg, typeof(ptr)); // string* pragma(msg, typeof(*ptr)); // string if(*h != exclude) keep ~= i; } } test.d(9): Error: incompatible types for ((*cast(immutable(char)*)h) != (exclude)): 'immutable(char)' and 'string'
Comment #1
by dsimcha — 2011-10-13T09:49:30Z
(Slaps self in forehead.) Never mind, I see what I did now. I used *h where I meant *ptr and forgot that strings implicitly convert to char*.