www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1419] New: dup attr not checked in the sub-class

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


-- 
Aug 13 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1419


bugzilla digitalmars.com changed:

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





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.


-- 
Aug 13 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1419






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. 


-- 
Aug 13 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1419






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?


-- 
Nov 02 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1419






or at least add a compiler flag to warn the user.


-- 
Nov 02 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1419






I haven't changed my mind about it <g>.


-- 
Nov 02 2007