Bug 3980 – DMDFE confused about function pointer/whisper syntax when mixed with array indexing.

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86_64
OS
Linux
Creation time
2010-03-17T07:20:00Z
Last change time
2014-02-15T02:18:46Z
Assigned to
nobody
Creator
brix

Comments

Comment #0 by brix — 2010-03-17T07:20:51Z
http://dsource.org/projects/ldc/ticket/402 struct Stdout { static Stdout opCall(int i = 0) { Stdout s; return s; } } void main() { int[char[]] b; Stdout(b["hello"])(); // error, DMDFE thinks you want to declare b // of type Stdout["hello"] int (funcptr[4])(); // declares int[4] funcptr; }
Comment #1 by ellery-newcomer — 2010-03-17T13:11:43Z
This exact same thing bit me a long time ago. Caused by denial that dmd's parser grammar is context sensitive (or at least infinitely ambiguous). *** This issue has been marked as a duplicate of issue 2392 ***