D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3381 - [tdpl] Incorrect assessment of overriding in triangular-shaped hierarchy
Summary: [tdpl] Incorrect assessment of overriding in triangular-shaped hierarchy
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other All
: P2 normal
Assignee: No Owner
URL:
Keywords: diagnostic, patch, rejects-valid
: 3023 (view as issue list)
Depends on:
Blocks:
 
Reported: 2009-10-08 20:36 UTC by Andrei Alexandrescu
Modified: 2015-06-09 05:14 UTC (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrei Alexandrescu 2009-10-08 20:36:16 UTC
This code doesn't compile:

interface VisualElement {
   void draw();
}

interface Actor {
}

interface VisualActor : Actor, VisualElement {
}

class Sprite3 : Actor, VisualActor {
    override void draw() { }
}

The error message is:

Error: function test.Sprite3.draw does not override any function

If I comment out the implementation of draw I get:

Error: class test.Sprite3 interface function VisualElement.draw isn't implemented

Of course, both of these can't be true at the same time :o). The original program should compile and run properly.
Comment 1 Gide Nwawudu 2009-10-09 02:10:50 UTC
Looks like at dup of bug 3023.
Comment 2 Don 2009-10-19 12:13:55 UTC
Ha! Compiler bugs are not usually this silly.
Applies to D1 as well. This also fixes bug 3023. I suspect it probably fixes some other bugs too -- I'm amazed multiple inheritance has worked at all.
class.c, line 1198. 

	// Skip if b has already appeared
	for (int k = 0; k < i; k++)
	{
-	    if (b == interfaces[i])
+	    if (b == interfaces[k])
		goto Lcontinue;
	}
Comment 3 Don 2009-10-19 12:15:37 UTC
*** Issue 3023 has been marked as a duplicate of this issue. ***
Comment 4 Leandro Lucarella 2009-10-19 12:46:00 UTC
I wonder you (Andrei) don't search for existing bugs instead of blindly creating new ones =(

If you want to mark all TDPL bugs by prefixing [tldp] to the subject, you can edit the old bug's title.

I'm saying this because I saw several bugs which were duplicates of old ones.
Comment 5 Andrei Alexandrescu 2009-10-19 12:55:57 UTC
(In reply to comment #4)
> I wonder you (Andrei) don't search for existing bugs instead of blindly
> creating new ones =(
> 
> If you want to mark all TDPL bugs by prefixing [tldp] to the subject, you can
> edit the old bug's title.
> 
> I'm saying this because I saw several bugs which were duplicates of old ones.

I'll try to look harder. My problem is that I never know what keywords to look for.
Comment 6 Bill Baxter 2009-11-22 06:53:43 UTC
Looks like bug 2252 might be the same thing too.
Comment 7 Leandro Lucarella 2009-11-22 14:33:12 UTC
SVN commit: http://www.dsource.org/projects/dmd/changeset/262
Comment 8 Walter Bright 2009-12-06 00:46:29 UTC
Fixed dmd 1.053 and 2.037