[Issue 11584] New: std.typecons.Typedef assigned from const

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 23 12:23:20 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11584

           Summary: std.typecons.Typedef assigned from const
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-11-23 12:23:17 PST ---
import std.typecons: Typedef;
void main() {
    alias T = Typedef!int;
    immutable T bar;
    T foo1 = bar; // OK
    T foo2;
    foo2 = bar; // Error
}


dmd 2.065alpha gives:


...\dmd2\src\phobos\std\typecons.d(3853): Error: cannot implicitly convert
expression (v) of type immutable(Typedef!(int, 0)) to int
test.d(7): Error: template instance std.typecons.Typedef!(int,
0).Typedef.Proxy!(Typedef_payload).opAssign!(Typedef!(int, 0),
immutable(Typedef!(int, 0))) error instantiating
test.d(7): Error: template std.typecons.Typedef!(int,
0).Typedef.Proxy!(Typedef_payload).opAssign does not match any function
template declaration. Candidates are:
...\dmd2\src\phobos\std\typecons.d(3853):        std.typecons.Typedef!(int,
0).Typedef.Proxy!(Typedef_payload).opAssign(this X, V)(auto ref V v) if (!is(V
== typeof(this)))
...\dmd2\src\phobos\std\typecons.d(3841):        std.typecons.Typedef!(int,
0).Typedef.Proxy!(Typedef_payload).opAssign(this X)(auto ref typeof(this) v)
test.d(7): Error: template std.typecons.Typedef!(int,
0).Typedef.Proxy!(Typedef_payload).opAssign(this X, V)(auto ref V v) if (!is(V
== typeof(this))) cannot deduce template function from argument types
!()(immutable(Typedef!(int, 0)))

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


More information about the Digitalmars-d-bugs mailing list