Bug 2374 – (exp).Fn() fail assuming that exp is a type

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2008-09-25T17:25:50Z
Last change time
2019-08-20T11:21:34Z
Keywords
rejects-valid
Assigned to
Walter Bright
Creator
BCS

Comments

Comment #0 by shro8822 — 2008-09-25T17:25:50Z
struct S { void Fn(); } void main() { S s; (s).Fn(); }
Comment #1 by shro8822 — 2008-09-25T17:27:14Z
Errors: Line 9: Error: s is used as a type Line 9: Error: no property 'Fn' for type 'void' Line 9: Error: function expected before (), not 1 of type int
Comment #2 by bugzilla — 2008-10-04T03:56:08Z
In order to reduce ambiguities, expressions of the form (identifier) are not recognized as expressions. There is no purpose to such expressions, as they are equivalent to just plain identifier.
Comment #3 by shro8822 — 2008-10-04T14:58:54Z
the "(id)" form is useful in some code generation cases where the id is a trivial case of something that some times needs the () but where it's non trivial to known if it is. reopen at low priority.
Comment #4 by razvan.nitu1305 — 2019-08-20T11:21:34Z
Fixed in D2.