Thread overview
[Issue 1419] New: dup attr not checked in the sub-class
Aug 13, 2007
d-bugmail
Aug 13, 2007
d-bugmail
Aug 13, 2007
d-bugmail
Nov 03, 2007
d-bugmail
Nov 03, 2007
d-bugmail
Nov 03, 2007
d-bugmail
August 13, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1419

           Summary: dup attr not checked in the sub-class
           Product: D
           Version: 1.020
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: someanon@yahoo.com


dupdefbug.d:
================================
class A {
  int attr;
}

class B : A {
  int attr;
}
================================

$ dmd.exe -c dupdefbug.d

no error reported.

It should report B.attr is dup of A.attr.


-- 

August 13, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1419


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #1 from bugzilla@digitalmars.com  2007-08-13 13:34 -------
Why should it be an error? Fields are not accessed virtually, so there is no hijacking problem. The current behavior is as designed.

If you feel it should be changed, please start a thread in digitalmars.D and present the case.


-- 

August 13, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1419





------- Comment #2 from someanon@yahoo.com  2007-08-13 13:46 -------
Posted to digitalmars.D:

I think 90% of the time this happens it is a bug, not by the programmer's intention.

If it's designed to be so in D, I propose to change it; or at least reported by the compiler.


-- 

November 03, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1419





------- Comment #3 from someanon@yahoo.com  2007-11-03 00:24 -------
http://www.digitalmars.com/d/archives/digitalmars/D/dup_field_in_sub-class_should_be_reported_by_the_compiler_56787.html

Walter what do you think, should I reopen this bug?


-- 

November 03, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1419





------- Comment #4 from someanon@yahoo.com  2007-11-03 00:26 -------
or at least add a compiler flag to warn the user.


-- 

November 03, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1419





------- Comment #5 from bugzilla@digitalmars.com  2007-11-03 00:54 -------
I haven't changed my mind about it <g>.


--