Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Ticket #239 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

wrong method called in class

Reported by: mwarning Assigned to: lindquist
Priority: major Milestone:
Component: backend Version: hg tip
Keywords: Cc:

Description

This code is trapped in an infinite recursive loop calling B.foo.
Works for dmd (B.foo is only called once).

module main;

import tango.io.Stdout;


class A
{
	void foo()
	{
	}
}

class B : A
{
	void foo()
	{
		Stdout("foo called").newline;
		A.foo();
	}
}

void main()
{
	auto b = new B();
	b.foo();
}

Debian x64

LLVM D Compiler rev. 1128:83ef1e7cde70 (2009-03-20 15:50 +0100)
based on DMD v1.039 and llvm 2.5 (Fri Mar 20 16:28:16 2009)

Attachments

bug239.patch (1.6 kB) - added by ChristianK on 03/24/09 05:06:07.
ugly patch
bug239.d (265 bytes) - added by ChristianK on 03/24/09 08:32:21.
extended test case

Change History

03/24/09 05:06:07 changed by ChristianK

  • attachment bug239.patch added.

ugly patch

03/24/09 05:09:35 changed by ChristianK

  • owner changed from ChristianK to lindquist.
  • component changed from unspecified to backend.

Currently we ignore the DotTypeExp? the dmdfe emits in these cases to indicate static lookup. I've attached a patch to fix it, but it's rather ugly. I'd be glad if someone could suggest a better way of propagating that information from the DotTypeExp? in the context argument to the DotVarExp? that's deciding whether to do a virtual call or not.

03/24/09 08:32:21 changed by ChristianK

  • attachment bug239.d added.

extended test case

03/24/09 09:35:17 changed by ChristianK

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in [1136]. Thanks for the bug report!

Copyright © 2008, LDC Development Team.