www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4103] New: opAssign signature rules not enforced on templated opAssign

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

           Summary: opAssign signature rules not enforced on templated
                    opAssign
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bugzilla kyllingen.net



00:59:09 PDT ---
The "Operator Overloading" page of the spec says that:

   "...the following parameter signatures for opAssign
    are not allowed:
    ...
    opAssign(T)
    ...
    where T is the same type as the aggregate type A..."


However, the following compiles:

    import std.stdio;

    struct S
    {
        S opAssign(T)(T t)
        {
            writeln(T.stringof);
            return this;
        }
    }

    void main()
    {
        S a, b;
        a = b;
    }

When run, it prints 'S'.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 19 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4103


Lars T. Kyllingstad <bugzilla kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid



01:01:07 PDT ---
I am using DMD 2.043.

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