[Issue 2152] New: Parentheses usage inconsistency.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 18 03:48:34 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2152

           Summary: Parentheses usage inconsistency.
           Product: D
           Version: 1.027
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid, spec
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: gim913 at gmail.com


I'm not sure if this is a bug, and I don't know if this can be fixed.
I was playing with h3r3tic's Singleton template.
I have overloaded opIndex, and opIndexAssign in a class, and made the class
wrapped the class with singleton (it doesn't have a meaning probably any
function returning class will do the effect).

When getting value, I can skip brackets after function call, like:
foo = bar["something"];
but when setting value (calling opIndexAssign) I am forced to use
brackets around function call, otherwise I get compiler error:
bar()["something"] = foo;

Please take a look at following two testcases:

http://ncu.codepad.org/7pBqIx25
http://ncu.codepad.org/JjGFdmsO

Sorry, if this issue is a duplicate.


-- 



More information about the Digitalmars-d-bugs mailing list