[Issue 7883] New: Compiler crashes with double inheritance and function contract
http://d.puremagic.com/issues/show_bug.cgi?id=7883 Summary: Compiler crashes with double inheritance and function contract Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: dl...@grotmol.net --- Comment #0 from �yvind Grotmol dl...@grotmol.net 2012-04-10 03:14:43 PDT --- Created an attachment (id=1087) Test case crashing the compiler Class C inherits from B which inherits from A. All three classes define the same function. A and B specifies an out contract on the function (C may or may not specify an out contract, it doesn't matter). In this case, dmd crashes without error message, and doesn't generate the .exe file. Here is the verbose output: $ dmd -v e binaryC:\D\dmd2\windows\bin\dmd.exe version v2.058 configC:\D\dmd2\windows\bin\sc.ini parse e importall e importobject (C:\D\dmd2\windows\bin\..\..\src\druntime\import\object.di) semantic e semantic2 e semantic3 e At this point it just stops. The rest of the output should have been as follows, if I remove one of the two contracts: code e function e.A.foo function e.A.foo.__ensure function e.B.foo function e.C.foo function D main C:\D\dmd2\windows\bin\link.exe e,,nul,user32+kernel32/noi; -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7883] Compiler crashes with double inheritance and function contract
http://d.puremagic.com/issues/show_bug.cgi?id=7883 --- Comment #1 from �yvind Grotmol dl...@grotmol.net 2012-04-10 03:18:09 PDT --- Note the attached file has commented out one of the contracts and thus compiles; remove the // and the crash arises. Here is the Windows 7 crash information: Problem signature: Problem Event Name:APPCRASH Application Name:dmd.exe Application Version:0.0.0.0 Application Timestamp: Fault Module Name:dmd.exe Fault Module Version:0.0.0.0 Fault Module Timestamp: Exception Code:c005 Exception Offset:0004d784 OS Version:6.1.7601.2.1.0.256.48 Locale ID:1044 Additional Information 1:c0d2 Additional Information 2:c0d2fd7c47233db608dcc0a8dfa7e295 Additional Information 3:77a4 Additional Information 4:77a4546d10565e53c3340bd335ee63b4 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7883] Compiler crashes with double inheritance and function contract
http://d.puremagic.com/issues/show_bug.cgi?id=7883 --- Comment #2 from �yvind Grotmol dl...@grotmol.net 2012-04-10 03:19:46 PDT --- By the way, the test case compiles fine with gdc -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7878] A problem with purity and general templated algorithms
http://d.puremagic.com/issues/show_bug.cgi?id=7878 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Component|DMD |Phobos --- Comment #1 from Kenji Hara k.hara...@gmail.com 2012-04-10 03:32:39 PDT --- It is std.functional.binaryFun and std.algorithm.sort problem, not compiler's. If the instantiation of predicate a b that given to sort template function is failed, they hide actual errors and instead print their own error messages by static assert. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4532] std.string.format, std.stream methods, etc. still use the old doFormat instead of formattedWrite
http://d.puremagic.com/issues/show_bug.cgi?id=4532 Stewart Gordon s...@iname.com changed: What|Removed |Added CC||jmdavisp...@gmx.com --- Comment #12 from Stewart Gordon s...@iname.com 2012-04-10 03:38:13 PDT --- *** Issue 4754 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 4754] format and Format!() do not work with posix positional parameters
http://d.puremagic.com/issues/show_bug.cgi?id=4754 Stewart Gordon s...@iname.com changed: What|Removed |Added Status|ASSIGNED|RESOLVED CC||s...@iname.com Resolution||DUPLICATE --- Comment #1 from Stewart Gordon s...@iname.com 2012-04-10 03:38:13 PDT --- *** This issue has been marked as a duplicate of issue 4532 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7884] New: std.file.DirIterator.opApply is wrong.
http://d.puremagic.com/issues/show_bug.cgi?id=7884 Summary: std.file.DirIterator.opApply is wrong. Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: timon.g...@gmx.ch --- Comment #0 from timon.g...@gmx.ch 2012-04-10 03:54:23 PDT --- std.file.DirIterator.opApply always returns '1' instead of the result of the delegate call. This makes it impossible to properly exit from a foreach body that uses the DirIterator as the aggregate via a return or goto statement. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7884] std.file.DirIterator.opApply is wrong.
http://d.puremagic.com/issues/show_bug.cgi?id=7884 timon.g...@gmx.ch changed: What|Removed |Added Status|NEW |RESOLVED Resolution||WORKSFORME --- Comment #1 from timon.g...@gmx.ch 2012-04-10 03:59:22 PDT --- Apparently this is fixed in git head: struct DirIterator { private: RefCounted!(DirIteratorImpl, RefCountedAutoInitialize.no) impl; this(string pathname, SpanMode mode, bool followSymlink) { impl = typeof(impl)(pathname, mode, followSymlink); } public: @property bool empty(){ return impl.empty; } @property DirEntry front(){ return impl.front; } void popFront(){ impl.popFront(); } } No opApply anymore. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Mihail Strashun m.stras...@gmail.com changed: What|Removed |Added CC||m.stras...@gmail.com --- Comment #8 from Mihail Strashun m.stras...@gmail.com 2012-04-10 06:04:56 PDT --- If bug preventing almost any x64 D code interconnecting with C libs is not a blocker, I can hardly imagine what is. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7883] Compiler crashes with double inheritance and function contract
http://d.puremagic.com/issues/show_bug.cgi?id=7883 --- Comment #3 from �yvind Grotmol dl...@grotmol.net 2012-04-10 07:06:35 PDT --- (From update of attachment 1087) This file compiles as it stands; remove the // to make it crash dmd. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Jonathan M Davis jmdavisp...@gmx.com changed: What|Removed |Added CC||jmdavisp...@gmx.com --- Comment #9 from Jonathan M Davis jmdavisp...@gmx.com 2012-04-10 10:11:53 PDT --- If bug preventing almost any x64 D code interconnecting with C libs is not a blocker, I can hardly imagine what is. I don't know how Walter decides that sort of thing or how he treats blockers. I believe that the worse that we normally see is critical. But this is something which has _never_ worked, and it's in a newer feature - 64-bit code generation - and it's something that not everyone is using. So, something which was in D itself (as opposed to how it talks with C code) which used to work but doesn't now could certainly be more of a blocker than this, depending on what it was. But in general, 64-bit specific stuff is less critical in that it only affects those using 64-bit rather than _everyone_ like many bugs do. I would actually expect Walter to consider this critical rather than a blocker. Certainly, if blocker indicates that something should block a release, this isn't it, since the bug has been around for as long as dmd's 64-bit code generation has been. But that's up to him. Regardless, this is a huge issue, and it should probably be treated as a higher priority than it has been, but much of what _has_ been being worked on is high priority stuff which affects much more D code than this does, so I suppose that it's not all that surprising that Walter hasn't gotten around to this yet. Still, I'd hope that this would be taken care of sooner rather than later. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7878] A problem with purity and general templated algorithms
http://d.puremagic.com/issues/show_bug.cgi?id=7878 Jonathan M Davis jmdavisp...@gmx.com changed: What|Removed |Added CC||jmdavisp...@gmx.com --- Comment #2 from Jonathan M Davis jmdavisp...@gmx.com 2012-04-10 10:14:26 PDT --- That may be, but if overloaded operators are wrong (especially opEquals and opCmp), I would expect the compiler to give errors for those types before any instantiation of sort was even attempted, and clearly, that's not happening. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7815] Mixin template forward reference (?) regression
http://d.puremagic.com/issues/show_bug.cgi?id=7815 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Attachment #1085|0 |1 is obsolete|| --- Comment #13 from Walter Bright bugzi...@digitalmars.com 2012-04-10 10:19:52 PDT --- Created an attachment (id=1088) reduced test.d and scid/matrix.d this replaces the files scid/matrix.d and test.d in the test case. They are somewhat reduced. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7885] New: std.rationals too
http://d.puremagic.com/issues/show_bug.cgi?id=7885 Summary: std.rationals too 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 2012-04-10 15:35:23 PDT --- I suggest to add to Phobos rational numbers, based on BigInts. A simple implementation from the RosettaCode site: http://rosettacode.org/wiki/Arithmetic/Rational#D import std.bigint, std.traits; T gcd(T)(/*in*/ T a, /*in*/ T b) /*pure nothrow*/ { // std.numeric.gcd doesn't work with BigInt return (b != 0) ? gcd(b, a % b) : (a 0) ? -a : a; } T lcm(T)(/*in*/ T a, /*in*/ T b) { return a / gcd(a, b) * b; } BigInt toBig(T : BigInt)(/*const*/ ref T n) pure nothrow { return n; } BigInt toBig(T)(const ref T n) pure nothrow if (isIntegral!T) { return BigInt(n); } struct Rational { /*const*/ private BigInt num, den; // numerator denominator private enum Type { NegINF = -2, NegDEN = -1, NaRAT = 0, NORMAL = 1, PosINF = 2 }; this(U : Rational)(U n) pure nothrow { num = n.num; den = n.den; } this(U)(in U n) pure nothrow if (isIntegral!U) { num = toBig(n); den = 1UL; } this(U, V)(/*in*/ U n, /*in*/ V d) /*pure nothrow*/ { num = toBig(n); den = toBig(d); /*const*/ BigInt common = gcd(num, den); if (common != 0) { num /= common; den /= common; } else { // infinite or NOT a Number num = (num == 0) ? 0 : (num 0) ? -1 : 1; den = 0; } if (den 0) { // assure den is non-negative num = -num; den = -den; } } BigInt nomerator() /*const*/ pure nothrow @property { return num; } BigInt denominator() /*const*/ pure nothrow @property { return den; } string toString() /*const*/ { if (den == 0) { if (num == 0) return NaRat; else return ((num 0) ? - : +) ~ infRat; } return toDecimalString(num) ~ (den == 1 ? : (/ ~ toDecimalString(den))); } Rational opBinary(string op)(/*in*/ Rational r) /*const pure nothrow*/ if (op == + || op == -) { BigInt common = lcm(den, r.den); BigInt n = mixin(common / den * num ~ op ~ common / r.den * r.num ); return Rational(n, common); } Rational opBinary(string op)(/*in*/ Rational r) /*const pure nothrow*/ if (op == *) { return Rational(num * r.num, den * r.den); } Rational opBinary(string op)(/*in*/ Rational r) /*const pure nothrow*/ if (op == /) { return Rational(num * r.den, den * r.num); } Rational opBinary(string op, T)(in T r) /*const pure nothrow*/ if (isIntegral!T (op == + || op == - || op == * || op == /)) { return opBinary!op(Rational(r)); } Rational opBinary(string op)(in size_t p) /*const pure nothrow*/ if (op == ^^) { return Rational(num ^^ p, den ^^ p); } Rational opBinaryRight(string op, T)(in T l) /*const pure nothrow*/ if (isIntegral!T) { return Rational(l).opBinary!op(Rational(num, den)); } Rational opUnary(string op)() /*const pure nothrow*/ if (op == + || op == -) { return Rational(mixin(op ~ num), den); } int opCmp(T)(/*in*/ T r) /*const pure nothrow*/ { Rational rhs = Rational(r); if (type() == Type.NaRAT || rhs.type() == Type.NaRAT) throw new Exception(Compare invlove an NaRAT.); if (type() != Type.NORMAL || rhs.type() != Type.NORMAL) // for infinite return (type() == rhs.type()) ? 0 : ((type() rhs.type()) ? -1 : 1); BigInt diff = num * rhs.den - den * rhs.num; return (diff == 0) ? 0 : ((diff 0) ? -1 : 1); } int opEquals(T)(/*in*/ T r) /*const pure nothrow*/ { Rational rhs = Rational(r); if (type() == Type.NaRAT || rhs.type() == Type.NaRAT) return false; return num == rhs.num den == rhs.den; } Type type() /*const pure nothrow*/ { if (den 0) return Type.NORMAL; if (den 0) return Type.NegDEN; if (num 0) return Type.PosINF; if (num 0) return Type.NegINF; return Type.NaRAT; } } version (arithmetic_rational_main) { // test part void main() { import std.stdio, std.math; foreach (p; 2 .. 2 ^^ 19) { auto sum = Rational(1, p); immutable limit = 1 + cast(uint)sqrt(cast(real)p); foreach (factor; 2 .. limit) if (p % factor == 0)
[Issue 7886] New: derivedMembers infinite recursion
http://d.puremagic.com/issues/show_bug.cgi?id=7886 Summary: derivedMembers infinite recursion Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: regression Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: c...@klickverbot.at --- Comment #0 from klickverbot c...@klickverbot.at 2012-04-10 16:10:57 PDT --- Another regression in DMD 2.059 Git (7c22b8a) compared to D 2.058: --- struct A { static if (__traits(derivedMembers, A).length) {} } --- The reason is quite obvious from the backtrace, DMD recurses infinitely while trying to get the list of members even if the static if doesn't add members: --- #0 0x001e70ec in TraitsExp::semantic (this=0xbf800288, sc=0x352000) at traits.c:77 #1 0x000be883 in UnaExp::semantic (this=0x426d00, sc=0x681b70) at expression.c:5844 #2 0x000e1d54 in DotIdExp::semantic (this=0x426d00, sc=0x681b70, flag=0) at expression.c:6450 #3 0x000c0520 in DotIdExp::semantic (this=0x426d00, sc=0x681b70) at expression.c:6382 #4 0x0007e78d in StaticIfCondition::include (this=0x426d20, sc=0x681b70, s=0x0) at cond.c:257 #5 0x71d2 in ConditionalDeclaration::include (this=0x426d60, sc=0x681ac0, sd=0x0) at attrib.c:1242 #6 0x0008b92a in ScopeDsymbol::foreach (sc=0x681ac0, members=0x426bc0, dg=0x1e9630 _ZZN9TraitsExp8semanticEP5ScopeEN12PushIdentsDg2dgEPvmP7Dsymbol, ctx=0x681b50, pn=0x0) at dsymbol.c:1148 . . . --- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7887] New: [CTFE] can't assign to returned reference
http://d.puremagic.com/issues/show_bug.cgi?id=7887 Summary: [CTFE] can't assign to returned reference Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: mailm...@nilsb.dyndns.org --- Comment #0 from Nils mailm...@nilsb.dyndns.org 2012-04-10 18:54:14 PDT --- $ cat test.d ref int ref_(ref int x) { return x; } void f() { int x; ref_(x) = 42; } static assert({f(); return true;}()); $ dmd -c -o- test.d test.d(6): Error: CTFE internal error: unsupported assignment ref_(x) = 42 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7886] derivedMembers infinite recursion
http://d.puremagic.com/issues/show_bug.cgi?id=7886 --- Comment #1 from github-bugzi...@puremagic.com 2012-04-10 19:05:47 PDT --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/5e555d5fb8570ce27aafa5cdd4fb29a99e813c76 fix Issue 7886 - derivedMembers infinite recursion -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7888] New: derivedMembers forward reference
http://d.puremagic.com/issues/show_bug.cgi?id=7888 Summary: derivedMembers forward reference Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: regression Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: c...@klickverbot.at --- Comment #0 from klickverbot c...@klickverbot.at 2012-04-10 19:07:18 PDT --- The different behavior of is() from bug 7868 depending on whether it was invoked from a static if condition or not might be acceptable, but this example is clearly a regression in my eyes: --- module a; struct A { import b : c; // Instantiate template which uses derivedMembers. alias D!A Test; // Unrelated template from other module - �not defined�. static if (c!()()) {} } // Just something using derivedMembers. template D(T) { mixin({ foreach (name; __traits(derivedMembers, T)) {} return ; }()); } --- --- module b; bool c()() { return true; } --- It compiled fine in DMD 2.058, but fails with �template instance c!() template 'c' is not defined, did you mean a?� in latest Git master (7c22b8a), which is absolutely not related to the cause of the error. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7886] derivedMembers infinite recursion
http://d.puremagic.com/issues/show_bug.cgi?id=7886 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Status|NEW |RESOLVED CC||bugzi...@digitalmars.com Resolution||FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7888] derivedMembers forward reference error with nested imports
http://d.puremagic.com/issues/show_bug.cgi?id=7888 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Status|NEW |RESOLVED CC||bugzi...@digitalmars.com Resolution||FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7815] Mixin template forward reference (?) regression
http://d.puremagic.com/issues/show_bug.cgi?id=7815 --- Comment #14 from klickverbot c...@klickverbot.at 2012-04-10 22:38:19 PDT --- Drastically reduced test case: ——— struct Expression(string op_, Lhs) { enum lhsClosure = closureOf!Lhs; } template closureOf(T) { static if (is(typeof({ T x; x + x; }))) {} enum closureOf = 1; } struct BasicVector { void t() { auto r = Expression!(t, typeof(this))(); } auto opBinary( string op, NewRhs )( NewRhs ) { return Expression!(+, typeof(this))(); } } ——— -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---