Bug 769 – Property not properly compiled - (error on valid code)

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
Other
OS
All
Creation time
2006-12-29T18:21:57Z
Last change time
2019-05-16T09:01:00Z
Keywords
rejects-valid
Assigned to
Walter Bright
Creator
Marcin Kuszczak

Comments

Comment #0 by aarti — 2006-12-29T18:21:57Z
class DataManager { public: static DataManager instance() { if (dataManager is null) { dataManager=new DataManager; } return dataManager; } T get(T)(long row) { return T.init; } } ---- Following makes problem: 1. (DataManager.instance).get!(T)(row); Error: found '!' when expecting ';' following 'statement' Error: C style cast illegal, use cast(T)(row) 2. DataManager.instance.get!(T)(row); Error: template setField!(T) is not a member of instance Error: function expected before (), not 0 of type int When written as: DataManager.instance().get!(T)(row); everything is OK.
Comment #1 by thomas-dloop — 2007-04-05T05:26:30Z
Comment #2 by smjg — 2007-05-05T11:53:36Z
Here's some code that really does reproduce the problem: class DataManager { static DataManager dataManager; public: static DataManager instance() { if (dataManager is null) { dataManager=new DataManager; } return dataManager; } T get(T)(long row) { return T.init; } } void main() { (DataManager.instance).get!(int)(123); }
Comment #3 by andrei — 2010-11-26T14:05:54Z
Second version works with 2.050, first problem persists.
Comment #4 by razvan.nitu1305 — 2019-05-16T09:01:00Z
Both version compile fine in D2. Closing as fixed.