[Issue 5158] Allow operator overloading on non-type template instances

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 18 12:51:09 PST 2012


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


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-12-18 12:51:08 PST ---
This works:

template foo( alias A )
{
    struct Foo
    {
        void opAssign( typeof( A ) arg )
        {
            A = arg;
        }
    }

    enum foo = Foo();
}

void main()
{
    int a;
    foo!a = 4;
}

Note that changing 'enum foo' to 'auto foo' creates a segfault at runtime,
which might be an interesting unrelated bug.

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


More information about the Digitalmars-d-bugs mailing list