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

           Summary: std.typecons.Typedef problem with immutable
                    initialized in static this()
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2012-03-19 17:22:46 PDT ---
I don't know if it's possible to fix this just changing Phobos. Maybe more is
needed.

Tests performed with DMD 2.059head:

This compiles:

alias int[] Arr;
immutable Arr a;
pure nothrow static this() {
    a = [1, 2, 3];
}
void main() {}



This compiles (with -d):

typedef int[] Arr;
immutable Arr a;
pure nothrow static this() {
    a = [1, 2, 3];
}
void main() {}



This compiles:

import std.typecons: Typedef;
alias Typedef!(int[]) Arr;
Arr a;
nothrow static this() {
    a = [1, 2, 3];
}
void main() {}



But this doesn't compile:

import std.typecons: Typedef;
alias Typedef!(int[]) Arr;
immutable Arr a;
pure nothrow static this() {
    a = [1, 2, 3];
}
void main() {}


It gives:

test.d(5): Error: template
std.typecons.Typedef!(int[],null).Typedef.Proxy!(Typedef_payload).opAssign(this
X,V) does not match any function template declaration
test.d(5): Error: template
std.typecons.Typedef!(int[],null).Typedef.Proxy!(Typedef_payload).opAssign(this
X,V) cannot deduce template function from argument types !()(int[])

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

Reply via email to