Four things

bearophile bearophileHUGS at lycos.com
Tue May 3 03:23:17 PDT 2011


Do you know if the following four problems are already present in Bugzilla? I don't remember (the only problem I am more sure is not present in Bugzilla is the missed priting in the first program).

----------------------------

import std.algorithm, std.stdio;
void main() {
    int[int] hash = [1:2, 3:4];
    auto vals = hash.byValue();
    writeln(vals); // int delegate(int delegate(ref int))
    map!q{a}(vals);
}


The writeln doesn't print the items.

And the last line causes this:

...\dmd\src\phobos\std\algorithm.d(110): Error: template instance Map!(result,int delegate(int delegate(ref int) dg)) does not match template declaration Map(alias fun,Range) if (isInputRange!(Unqual!(Range)))

----------------------------

void main() {
  auto a = [,,,,,,,,];
}


This is ugly.

----------------------------

struct Foo {
    int x;
    this(int xx) {
        this.x = xx;
    }
}
void main() {
    enum f = Foo(10);
}


DMD 2.052 refuses this code that looks valid.

---------------------------

Thank you,
bye,
bearophile


More information about the Digitalmars-d-learn mailing list