View mode: basic / threaded / horizontal-split · Log in · Help
May 03, 2011
Four things
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
May 03, 2011
Re: Four things
On 5/3/11, bearophile <bearophileHUGS@lycos.com> wrote:
> struct Foo {
>     int x;
>     this(int xx) {
>         this.x = xx;
>     }
> }
> void main() {
>     enum f = Foo(10);
> }
>

Perhaps a relevant bug is where a struct-typed enum doesn't call the
struct ctor if it has one, but uses field-by-field initialization
instead. See http://d.puremagic.com/issues/show_bug.cgi?id=5460
Top | Discussion index | About this forum | D home