www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9080] New: DMD compile ambiguous code or doesn’t even warn

reply d-bugmail puremagic.com writes:
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



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: -------
Nov 25 2012
next sibling parent d-bugmail puremagic.com writes:
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



No ambiguity, changed title.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 25 2012
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Dec 20 2012