Thread overview
Strange type redifinition error
Oct 08, 2008
Denis Koroskin
Oct 08, 2008
Benji Smith
Oct 08, 2008
torhu
Oct 08, 2008
Benji Smith
Oct 08, 2008
Denis Koroskin
October 08, 2008
I am getting the following error message on one of my source files (D2.019):

Path.d(56): Error: Types.BOOL at Types.d(5) conflicts with win32.windef.BOOL at win32\windef.d(60)

win32\windef.d(60) looks like this:
alias int     WINBOOL, BOOL, INT, LONG, HFILE, HRESULT;

Types.d(5) looks like this:
import win32.windef : BOOL;

Path.d includes lots of files that include both Types.d and win32\windef.d through a long inclusion chain.

Why does "import win32.windef : BOOL;" defines new type?
It is a bug, I guess. Removing ": BOOL;" solves the problem. Shall I put it into bugzilla?
October 08, 2008
Denis Koroskin wrote:
> I am getting the following error message on one of my source files (D2.019):
> 
> Path.d(56): Error: Types.BOOL at Types.d(5) conflicts with win32.windef.BOOL at win32\windef.d(60)
> 
> win32\windef.d(60) looks like this:
> alias int     WINBOOL, BOOL, INT, LONG, HFILE, HRESULT;
> 
> Types.d(5) looks like this:
> import win32.windef : BOOL;
> 
> Path.d includes lots of files that include both Types.d and win32\windef.d through a long inclusion chain.
> 
> Why does "import win32.windef : BOOL;" defines new type?
> It is a bug, I guess. Removing ": BOOL;" solves the problem. Shall I put it into bugzilla?

This sounds spookily familiar to a bug I logged last month. But I was using Tango, and it sounds like you're using Phobos. Here's my bug report:

http://www.dsource.org/projects/tango/ticket/1249

This could be one of those cases where the same bits of code were copied and pasted into both Phobos and Tango, resulting in duplicate bugs. If you do post a bugzilla report, maybe add a link to the Tango bug. It might help.

--benji
October 08, 2008
Benji Smith wrote:
> Denis Koroskin wrote:
>> I am getting the following error message on one of my source files (D2.019):
>> 
>> Path.d(56): Error: Types.BOOL at Types.d(5) conflicts with win32.windef.BOOL at win32\windef.d(60)
>> 
>> win32\windef.d(60) looks like this:
>> alias int     WINBOOL, BOOL, INT, LONG, HFILE, HRESULT;
>> 
>> Types.d(5) looks like this:
>> import win32.windef : BOOL;
>> 
>> Path.d includes lots of files that include both Types.d and win32\windef.d through a long inclusion chain.
>> 
>> Why does "import win32.windef : BOOL;" defines new type?
>> It is a bug, I guess. Removing ": BOOL;" solves the problem. Shall I put it into bugzilla?
> 
> This sounds spookily familiar to a bug I logged last month. But I was using Tango, and it sounds like you're using Phobos. Here's my bug report:
> 
> http://www.dsource.org/projects/tango/ticket/1249
> 
> This could be one of those cases where the same bits of code were copied and pasted into both Phobos and Tango, resulting in duplicate bugs. If you do post a bugzilla report, maybe add a link to the Tango bug. It might help.

I think it's a different issue.  Selective imports work the same way as aliases.  So in a way, BOOL is defined twice.  If this is by design or accident, I don't know.

import win32.windef : BOOL;

is the same as:

import win32.windef;
alias win32.windef.BOOL BOOL;
October 08, 2008
torhu wrote:
> I think it's a different issue.  Selective imports work the same way as aliases.  So in a way, BOOL is defined twice.  If this is by design or accident, I don't know.
> 
> import win32.windef : BOOL;
> 
> is the same as:
> 
> import win32.windef;
> alias win32.windef.BOOL BOOL;

Gotcha. I just didn't read the original post closely enough.

--benji
October 08, 2008
Thanks to you all for your help!

On Wed, 08 Oct 2008 23:43:24 +0400, torhu <no@spam.invalid> wrote:

> Benji Smith wrote:
>> Denis Koroskin wrote:
>>> I am getting the following error message on one of my source files (D2.019):
>>>  Path.d(56): Error: Types.BOOL at Types.d(5) conflicts with win32.windef.BOOL at win32\windef.d(60)
>>>  win32\windef.d(60) looks like this:
>>> alias int     WINBOOL, BOOL, INT, LONG, HFILE, HRESULT;
>>>  Types.d(5) looks like this:
>>> import win32.windef : BOOL;
>>>  Path.d includes lots of files that include both Types.d and win32\windef.d through a long inclusion chain.
>>>  Why does "import win32.windef : BOOL;" defines new type?
>>> It is a bug, I guess. Removing ": BOOL;" solves the problem. Shall I put it into bugzilla?
>>  This sounds spookily familiar to a bug I logged last month. But I was using Tango, and it sounds like you're using Phobos. Here's my bug report:
>>  http://www.dsource.org/projects/tango/ticket/1249
>>  This could be one of those cases where the same bits of code were copied and pasted into both Phobos and Tango, resulting in duplicate bugs. If you do post a bugzilla report, maybe add a link to the Tango bug. It might help.
>
> I think it's a different issue.  Selective imports work the same way as aliases.  So in a way, BOOL is defined twice.  If this is by design or accident, I don't know.
>
> import win32.windef : BOOL;
>
> is the same as:
>
> import win32.windef;
> alias win32.windef.BOOL BOOL;

Yes, but that doesn't create new type so no conflicts should be here.

I filled the report: http://d.puremagic.com/issues/show_bug.cgi?id=2401