www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Clash between functions that shouldn't be in the same partial ordering

reply "TommiT" <tommitissari hotmail.com> writes:
I'm pretty sure the following is a compiler bug, right? (using 
DMD 2.063)

---------
module a;

void foo(char)
{
}

---------
module b;

enum MyEnum : int { _ }

void foo(MyEnum)
{
}

---------
module main;

import a;
import b;

void main()
{
     foo(char.init);
     foo(MyEnum.init); // [1]
}

// 1) Error: b.foo at b.d(5) conflicts with a.foo at a.d(3)

There shouldn't be a problem with this cross-module overloading, 
because MyEnum isn't implicitly convertible to char and vice 
versa, and thus the partial ordering of functions should consider 
a.foo and b.foo unordered.
Jun 14 2013
parent reply "Jonathan M Davis" <jmdavisProg gmx.com> writes:
On Saturday, June 15, 2013 01:09:28 TommiT wrote:
 I'm pretty sure the following is a compiler bug, right? (using
 DMD 2.063)
 
 ---------
 module a;
 
 void foo(char)
 {
 }
 
 ---------
 module b;
 
 enum MyEnum : int { _ }
 
 void foo(MyEnum)
 {
 }
 
 ---------
 module main;
 
 import a;
 import b;
 
 void main()
 {
 foo(char.init);
 foo(MyEnum.init); // [1]
 }
 
 // 1) Error: b.foo at b.d(5) conflicts with a.foo at a.d(3)
 
 There shouldn't be a problem with this cross-module overloading,
 because MyEnum isn't implicitly convertible to char and vice
 versa, and thus the partial ordering of functions should consider
 a.foo and b.foo unordered.
It certainly looks like a bug to me. - Jonathan M Davis
Jun 14 2013
parent "TommiT" <tommitissari hotmail.com> writes:
On Saturday, 15 June 2013 at 02:39:31 UTC, Jonathan M Davis wrote:
 On Saturday, June 15, 2013 01:09:28 TommiT wrote:
 I'm pretty sure the following is a compiler bug, right? (using
 DMD 2.063)
 
 ---------
 module a;
 
 void foo(char)
 {
 }
 
 ---------
 module b;
 
 enum MyEnum : int { _ }
 
 void foo(MyEnum)
 {
 }
 
 ---------
 module main;
 
 import a;
 import b;
 
 void main()
 {
 foo(char.init);
 foo(MyEnum.init); // [1]
 }
 
 // 1) Error: b.foo at b.d(5) conflicts with a.foo at a.d(3)
 
 There shouldn't be a problem with this cross-module 
 overloading,
 because MyEnum isn't implicitly convertible to char and vice
 versa, and thus the partial ordering of functions should 
 consider
 a.foo and b.foo unordered.
It certainly looks like a bug to me. - Jonathan M Davis
Bug report there: http://d.puremagic.com/issues/show_bug.cgi?id=10361
Jun 14 2013