[Issue 5939] Cannot copy std.algorithm.map
http://d.puremagic.com/issues/show_bug.cgi?id=5939 kenn...@gmail.com changed: What|Removed |Added CC||kenn...@gmail.com --- Comment #1 from kenn...@gmail.com 2011-05-06 23:15:51 PDT --- The problem isn't copying a map, but initializing the type using 'T xSaved'. If you use 'T xSaved = x;' it compiles. A reduced example: - import std.algorithm; void main() { typeof(map!a([0])) a; } - x.d(3): Error: function std.algorithm.map!(a).map!(int[]).map is a nested function and cannot be accessed from main - -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5940] Cannot create arrays of std.algorithm.map
http://d.puremagic.com/issues/show_bug.cgi?id=5940 kenn...@gmail.com changed: What|Removed |Added CC||kenn...@gmail.com --- Comment #1 from kenn...@gmail.com 2011-05-06 23:29:24 PDT --- See as issue 4274. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5930] cas doesn't work when used in code compiled with -D
http://d.puremagic.com/issues/show_bug.cgi?id=5930 Rainer Schuetze r.sagita...@gmx.de changed: What|Removed |Added CC||r.sagita...@gmx.de --- Comment #2 from Rainer Schuetze r.sagita...@gmx.de 2011-05-06 23:31:50 PDT --- phobos now uses version StdDdoc instead of D_Ddoc to fix similar issues. Grep tells me core.atomic is the only module in druntime that uses version(D_ddoc). What needs to be done is: - add -version=DruntimeDdoc or similar to DOCFMT in the makefiles - use version(DruntimeDdoc) instead of version(D_Ddoc) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 3581] private attribute breaks override
http://d.puremagic.com/issues/show_bug.cgi?id=3581 --- Comment #15 from Rainer Schuetze r.sagita...@gmx.de 2011-05-06 23:37:50 PDT --- (In reply to comment #13) See proposed patch and problems with patch: https://github.com/donc/dmd/commit/9f7b2f8cfe5d7482f2de7f9678c176d54abe237f#commitcomment-321724 Copying my comment on github for better visibility: As I happen to have the patch installed, I stumbled over this problem today when running the unittests. The problem is that the override sets the attribute for the complete mixin, including auto-implemented constructors. Here's a patch that moves the override attribute to each generated function if it is not a constructor: diff --git a/std/typecons.d b/std/typecons.d index e0868b0..979b1d1 100644 --- a/std/typecons.d +++ b/std/typecons.d @@ -1593,7 +1593,7 @@ class AutoImplement(Base, alias how, alias what = isAbstractFunction) : Base private alias AutoImplement_Helper!( autoImplement_helper_, Base, Base, how, what ) autoImplement_helper_; -override mixin(autoImplement_helper_.code); +mixin(autoImplement_helper_.code); } /* @@ -2081,6 +2081,8 @@ private static: enum storageClass = make_storageClass(); // +if(isAbstractFunction!func) +code ~= override ; code ~= Format!(extern(%s) %s %s(%s) %s %s\n, functionLinkage!(func), returnType, -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5939] Cannot copy std.algorithm.map
http://d.puremagic.com/issues/show_bug.cgi?id=5939 --- Comment #2 from kenn...@gmail.com 2011-05-06 23:52:03 PDT --- The bug is introduced in commit 1083bd4e (https://github.com/D-Programming-Language/phobos/commit/1083bd4e7b4ef0475084d7eab2e67c65e511c3d4#L1L160), where the return type of map changes from an external private struct to an inner struct. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5941] New: Using inner struct which references nested function in a no-attribute or auto-return member function causes nested function cannot be accessed error
http://d.puremagic.com/issues/show_bug.cgi?id=5941 Summary: Using inner struct which references nested function in a no-attribute or auto-return member function causes nested function cannot be accessed error Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: kenn...@gmail.com --- Comment #0 from kenn...@gmail.com 2011-05-07 00:11:05 PDT --- May or may not be the same as issue 5939. Happens at least since 2.042. Test case: - auto f() { static int h(int x) pure nothrow @safe { return x*x*x-x*x; } struct S { int get() { return h(8); } } return S.init; } void main() { typeof(f()) z; assert(z.get == 448); assert(z.get == 448); } - x.d(11): Error: function x.f is a nested function and cannot be accessed from main - The bug will appear only when the 'get' function - is an auto-return function (e.g. '@property auto get()') - or has no attributes at all (e.g. 'int get()') The bug is gone when you supply at least one attribute to 'get', e.g. '@safe int get()'. I don't know if it is a reject-valid or accept-invalid. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5941] Using inner struct which references nested function in a no-attribute or auto-return member function causes nested function cannot be accessed error
http://d.puremagic.com/issues/show_bug.cgi?id=5941 --- Comment #1 from kenn...@gmail.com 2011-05-07 00:27:39 PDT --- A slight variant is when 'f' is a template function taking a delegate literal as input, it will generate an ICE: - auto f(alias T)() { static void h(){} struct S { void get() { h(); } } return S(); } void main() { typeof(f!((){})()) z; } - Internal error: backend/cgcs.c 363 - -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5942] New: Bitfields are overwritten erroneously
http://d.puremagic.com/issues/show_bug.cgi?id=5942 Summary: Bitfields are overwritten erroneously Product: D Version: D2 Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: samu...@voliacable.com --- Comment #0 from Max Samukha samu...@voliacable.com 2011-05-07 04:03:20 PDT --- struct S { mixin(bitfields!( int, a , 32, int, b , 32 )); } void main() { S data; data.b = 42; data.a = 1; assert(data.b == 42); // fail } Looks like assigning fields at offsets 32 bit clears fields at offsets = 32 bit. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5943] New: Power expression optimisation: 2^^unsigned == 1unsigned
http://d.puremagic.com/issues/show_bug.cgi?id=5943 Summary: Power expression optimisation: 2^^unsigned == 1unsigned Product: D Version: D2 Platform: All OS/Version: Windows Status: NEW Keywords: performance Severity: enhancement Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2011-05-07 05:27:50 PDT --- Related to bug 5812 I think it's good to have an optimization of 2^^x == 1x when x is an unsigned integral or where the compiler can infer x to be a not negative integral: import std.math; // currently std.math is needed here int main(string[] args) { return 2 ^^ args.length; } Currently it generates: __Dmaincomdat L0:pushEAX push2 movEAX,0Ch[ESP] callnear ptr _D3std4math12__T3powTiTkZ3powFNaNbNeikZk popECX ret -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5944] New: Five ideas for the stacktrace
http://d.puremagic.com/issues/show_bug.cgi?id=5944 Summary: Five ideas for the stacktrace Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: diagnostic Severity: enhancement Priority: P2 Component: druntime AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2011-05-07 06:06:11 PDT --- This little program: int foo(int x, int y) { return x / y; } void main() { foo(1, 0); } Produces the stack trace (dmd 2.053beta): object.Error: Integer Divide by Zero ...\test.d(5): _Dmain While this similar Python2 program: def foo(x, y): return x / y def main(): foo(1, 0) main() Gives the stacktrace (feel fee to ignore the first global call to main()): Traceback (most recent call last): File ...\temp.py, line 5, in module main() File ...\temp.py, line 4, in main foo(1, 0) File ...\temp.py, line 2, in foo return x / y ZeroDivisionError: integer division or modulo by zero [Idea1] On Python the stacktrace is reversed compared to the D one, maybe this is better. [Idea2] And as first line it prints this, that's useful for D too: Traceback (most recent call last): [Idea3] And the Python stacktrace shows the line/function where the division by zero happens too, instead of just all the frames of the functions up to the one that has called the function that has generated the division by zero. I'd like to see foo() too in the D stacktrace. This program: int foo(int x) { if (x 0) return bar(x - 1); else return 10 / x; } int bar(int x) { if (x 0) return foo(x - 1); else return 10 / x; } void main() { foo(10); } dmd 2.053beta (witout -g switch) gives: object.Error: Integer Divide by Zero 40CCF4 40CB6B 402041 402021 402041 402021 402041 402021 402041 402021 402041 402021 40205A 4025FB 4021F7 411FDD [Idea4] When the -g switch is not used I suggest to add a note about missing debug info, useful for not expert programmers/newbies: object.Error: Integer Divide by Zero Traceback, no symbolic debug info (most recent call last): 40CCF4 40CB6B 402041 402021 402041 402021 402041 402021 402041 402021 402041 402021 40205A 4025FB 4021F7 411FDD Instead of just: object.Error: Integer Divide by Zero Traceback (most recent call last): 40CCF4 40CB6B 402041 402021 402041 402021 402041 402021 402041 402021 402041 402021 40205A 4025FB 4021F7 411FDD This little program: int foo(int x) { if (x 0) return foo(x - 1); else return 10 / x; } void main() { foo(10); } dmd 2.053beta gives just (here DMD has performed tail-call optimization, so there are no stack frames to show for the recursive calls to foo()): object.Error: Integer Divide by Zero ... A bigger similar example: import core.stdc.stdio: printf; nothrow pure int str2int(const char *str, in int n=0) { if (str == null || *str == '\0') { int x = 10 / cast(size_t)*str; // A bug return n; } else return str2int(str+1, n*10 + *str-'0'); } void main() { printf(%d\n, str2int(12345678.ptr)); } The asm shows that DMD performs the tail-call optimization on str2int(): _D5test37str2intFNaNbxPaxiZicomdat pushEBX mov EBX,8[ESP] testEBX,EBX pushESI mov ESI,EAX pushEDI je L12 cmp byte ptr [EBX],0 jne L1A L12:pop EDI mov EAX,ESI pop ESI pop EBX ret 4 L1A:lea EDX,1[EBX] movzx ECX,byte ptr [EBX] lea EDI,[ESI*4][ESI] lea EDI,-030h[EDI*2][ECX] mov ESI,EDI mov EBX,EDX testEDX,EDX je L12 cmp byte ptr [EDX],0 je L12 jmp short L1A object.Error: Integer Divide by Zero ... [Idea5] In this case the stacktrace may add a note: object.Error: Integer Divide by Zero ...\test.d(4): int test.str2int(const char*, const int) [Tail-Call Optimized] -- This little program just crashes at runtime (dmd 2.053beta): int foo() { return foo(); } void main() { foo(); } With DMD 2.052 it gives: object.Error: Stack Overflow -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5945] New: redBlackTree printing
http://d.puremagic.com/issues/show_bug.cgi?id=5945 Summary: redBlackTree printing Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2011-05-07 06:13:17 PDT --- This little program: import std.stdio, std.container; void main() { auto t = redBlackTree(0, 7, 5, 2); writeln(t); writeln(t[]); } Prints (DMD 2.053 beta): std.container.RedBlackTree!(int).RedBlackTree [0, 2, 5, 7] But often I'd like collections to print something that's able to generate the data structure again, as in Python: s = set([1, 2, 3]) s set([1, 2, 3]) l = [1, 2, 3] l [1, 2, 3] d = {1:1, 2:2, 3:3} d {1: 1, 2: 2, 3: 3} This is very useful for debugging, logging, for quick scripts, etc. So I'd like one of the two (the first one?) to print something more like this instead: redBlackTree(0, 2, 5, 7) This too is acceptable: std.container.redBlackTree(0, 2, 5, 7) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 693] 'this' can't be used as an alias parameter for a mixin
http://d.puremagic.com/issues/show_bug.cgi?id=693 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added CC||zan77...@nifty.com --- Comment #4 from Kenji Hara k.hara...@gmail.com 2011-05-07 06:20:37 PDT --- *** Issue 4799 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5944] Five ideas for the stacktrace
http://d.puremagic.com/issues/show_bug.cgi?id=5944 --- Comment #1 from bearophile_h...@eml.cc 2011-05-07 06:21:51 PDT --- KennyTM~ reminds me that the [idea 3] is bugus, because divisions by zero are not DMD exceptions. So please ignore it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5946] New: failing lookup 'this' from function in template
http://d.puremagic.com/issues/show_bug.cgi?id=5946 Summary: failing lookup 'this' from function in template Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: k.hara...@gmail.com --- Comment #0 from Kenji Hara k.hara...@gmail.com 2011-05-07 06:58:08 PDT --- Following code compile fails with https://github.com/D-Programming-Language/dmd/commit/3fcc2344681ab9d31d1897188f36051c9beb247f template TTest1() { int call(){ return this.g(); } } class CTest1 { int f() { mixin TTest1!(); return call(); } int g() { return 10; } } void main() { assert((new CTest1()).f() == 10); } test.d(3): Error: 'this' is only defined in non-static member functions, not call test.d(7): Error: mixin test.CTest1.f.TTest1!() error instantiating -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5947] New: Classes derived from templated interfaces do not check for method implementation
http://d.puremagic.com/issues/show_bug.cgi?id=5947 Summary: Classes derived from templated interfaces do not check for method implementation Product: D Version: D2 Platform: Other OS/Version: Mac OS X Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: rob...@octarineparrot.com --- Comment #0 from Robert Clipsham rob...@octarineparrot.com 2011-05-07 21:24:55 BST --- The following code: interface I(T) { T foo(); void bar(); } class C : I!int { } Compiles without error, it should complain that foo and bar are not implemented. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5947] Classes derived from interfaces do not check for method implementation with -o-
http://d.puremagic.com/issues/show_bug.cgi?id=5947 Robert Clipsham rob...@octarineparrot.com changed: What|Removed |Added Summary|Classes derived from|Classes derived from |templated interfaces do not |interfaces do not check for |check for method|method implementation with |implementation |-o- --- Comment #1 from Robert Clipsham rob...@octarineparrot.com 2011-05-07 21:38:51 BST --- It seems this is only happening when the -o- switch is being used, and happens regardless of whether the interface is templated. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5948] New: Different error messages for int array
http://d.puremagic.com/issues/show_bug.cgi?id=5948 Summary: Different error messages for int array Product: D Version: unspecified Platform: x86 OS/Version: Windows Status: NEW Keywords: diagnostic Severity: minor Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2011-05-07 16:07:43 PDT --- A wrong D2 program: void main() { int[] arr1 = [[1]]; enum int[] arr2 = [[1]]; } DMD 2.053beta gives: test.d(2): Error: cannot implicitly convert expression ([[1]]) of type int[][] to int[] test.d(3): Error: cannot use array to initialize int In this case I expect to receive two times the first error message. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5949] New: Mutable enum matrix rows
http://d.puremagic.com/issues/show_bug.cgi?id=5949 Summary: Mutable enum matrix rows Product: D Version: unspecified Platform: x86 OS/Version: Windows Status: NEW Keywords: accepts-invalid Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2011-05-07 16:08:46 PDT --- This D2 code compiles and runs with no errors (DMD 2.053beta), but it's wrong: void main() { enum int[][] data = [[1]]; foreach (a; data) a[0]++; assert(data[0][0] == 1); foreach (ref a; data) a[0]++; assert(data[0][0] == 1); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5950] New: Linker problem with AA.get()
http://d.puremagic.com/issues/show_bug.cgi?id=5950 Summary: Linker problem with AA.get() Product: D Version: unspecified Platform: x86 OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: druntime AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2011-05-07 16:12:45 PDT --- This D2 code: import std.stdio; void main() { string[char] tab = ['e': red, 'b': blue]; string r; foreach (c; aba) { // if (c in tab) r ~= tab[c]; // OK r ~= tab.get(c, ); // ERR } writeln(r); } Gives me a linker error (DMD 2.053beta): test.obj(test) Error 42: Symbol Undefined _D6object28__T16AssociativeArrayTaTAyaZ16AssociativeArray3getMFaLAyaZAya -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5951] New: writeln(AAbyValue()) doesn't show the values
http://d.puremagic.com/issues/show_bug.cgi?id=5951 Summary: writeln(AAbyValue()) doesn't show the values Product: D Version: unspecified Platform: x86 OS/Version: Windows Status: NEW Keywords: wrong-code Severity: normal Priority: P2 Component: druntime AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2011-05-07 16:24:13 PDT --- import std.stdio; void main() { int[int] hash = [1:2, 3:4]; auto vals = hash.byValue(); writeln(vals); } With DMD 2.053beta at runtime the writeln prints: int delegate(int delegate(ref int)) Expected: the sequence of the items, something like: [2; 4] See also bug 3813 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5952] New: map(AA.byValue()) problem
http://d.puremagic.com/issues/show_bug.cgi?id=5952 Summary: map(AA.byValue()) problem Product: D Version: unspecified 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 2011-05-07 16:27:16 PDT --- import std.algorithm; void main() { int[int] hash = [1:2, 3:4]; auto vals = hash.byValue(); map!q{a}(vals); // error } The line of code with map causes this (DMD 2.053beta): test.d(5): Error: template std.algorithm.map!(a).map(Range) if (isInputRange!(Unqual!(Range))) does not match any function template declaration test.d(5): Error: template std.algorithm.map!(a).map(Range) if (isInputRange!(Unqual!(Range))) cannot deduce template function from argument types !()(int delegate(int delegate(ref int) dg)) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5953] New: Too many trailing commas are accepted
http://d.puremagic.com/issues/show_bug.cgi?id=5953 Summary: Too many trailing commas are accepted Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: accepts-invalid Severity: minor Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2011-05-07 16:28:09 PDT --- Accepting an extra trailing comma is acceptable, but this looks excessive (this compiles and runs with no errors, DMD 2.053 beta): void main() { auto a = [,]; assert(a.length == 0); } As in Python I suggest to accept only one extra trailing comma: a = [1] a = [1,] a = [1,,] File stdin, line 1 a = [1,,] ^ SyntaxError: invalid syntax -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5954] New: enum structs with ctor
http://d.puremagic.com/issues/show_bug.cgi?id=5954 Summary: enum structs with ctor Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: enhancement Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 2011-05-07 16:31:20 PDT --- D2 code: struct Foo { int x; this(int xx) { this.x = xx; } } void main() { enum f = Foo(10); } DMD 2.053beta is not able to compile it, and shows the errors: test.d(8): Error: variable __ctmp3 cannot be read at compile time test.d(8): Error: cannot evaluate __ctmp3.this(10) at compile time -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---