D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7807 - Ambiguous virtual function error on const overloading with covariant return types
Summary: Ambiguous virtual function error on const overloading with covariant return t...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2012-04-01 13:55 UTC by Read Bixby
Modified: 2012-04-27 12:25 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Read Bixby 2012-04-01 13:55:17 UTC
The following code produces the error:  "Error: class Implementation ambiguous virtual function getNext"

interface Interface
{
	Interface getNext();
	const(Interface) getNext() const;
}

class Implementation : Interface
{
	Implementation getNext()
	{
		return null;
	}

	const(Implementation) getNext() const
	{
		return null;
	}
}

The error does not appear if "Interface" is changed to an abstract class.
Comment 2 github-bugzilla 2012-04-27 10:47:55 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/fecb72a7f64e346c27e082bf89efde83ff9ddf5b
fix Issue 7807 - Ambiguous virtual function error on const overloading with covariant return types