Thread overview
[Issue 9080] New: DMD compile ambiguous code or doesn’t even warn
Nov 25, 2012
Dimitri Sabadie
[Issue 9080] Reject effect-free assignment
Nov 25, 2012
timon.gehr@gmx.ch
Dec 20, 2012
Andrej Mitrovic
November 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9080

           Summary: DMD compile ambiguous code or doesn’t even warn
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: dimitri.sabadie@gmail.com


--- Comment #0 from Dimitri Sabadie <dimitri.sabadie@gmail.com> 2012-11-25 10:45:10 PST ---
Description:
Here’s a little snippet D code:

import std.stdio : writefln;

abstract class A {
    int a;
}

class B : A {
    this(int a) {
        a = a;
    }
}

int main() {
    auto b = new B(314);

    writefln("value: %d", b.a);
    return 0;
}

Compiling it with:
    dmd -debug -w -wi auto_aff.d

DMD fails to figure out the auto-affectation. The fact that it either: 1. compiles and has an obviously but hard to find incorrect behavior ; 2. compiles and segfault if `a' is a class or struct for instance.

If we go with in int a, DMD figures it out. So, I think a warning should be appreciated for that behavior.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 25, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9080


timon.gehr@gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timon.gehr@gmx.ch
            Summary|DMD compile ambiguous code  |Reject effect-free
                   |or doesn’t even warn        |assignment
           Severity|major                       |enhancement


--- Comment #1 from timon.gehr@gmx.ch 2012-11-25 11:21:19 PST ---
No ambiguity, changed title.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9080


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich@gmail.com
         Resolution|                            |DUPLICATE


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-12-20 15:03:53 PST ---
In the future please do not mark bugs as x86_64 and OS-specific if they bugs are not tied specifically to those systems.

*** This issue has been marked as a duplicate of issue 4407 ***

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