www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 769] New: Property not properly compiled - (error on valid code)

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=769

           Summary: Property not properly compiled - (error on valid code)
           Product: D
           Version: 0.178
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: aarti interia.pl


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.


-- 
Dec 29 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=769





------- Comment #1 from thomas-dloop kuehne.cn  2007-04-05 05:26 -------
Added to DStress as
http://dstress.kuehne.cn/run/t/template_56_A.d
http://dstress.kuehne.cn/run/t/template_56_B.d


-- 
Apr 05 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=769


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
           Keywords|                            |rejects-valid




------- Comment #2 from smjg iname.com  2007-05-05 11:53 -------
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);
}


-- 
May 05 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=769


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |bugzilla digitalmars.com


--- Comment #3 from Andrei Alexandrescu <andrei metalanguage.com> 2010-11-26
14:05:54 PST ---
Second version works with 2.050, first problem persists.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 26 2010