[Issue 9080] New: DMD compile ambiguous code or doesnât even warn
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Nov 25 10:45:11 PST 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 at puremagic.com
ReportedBy: dimitri.sabadie at gmail.com
--- Comment #0 from Dimitri Sabadie <dimitri.sabadie at 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: -------
More information about the Digitalmars-d-bugs
mailing list