Board index » cppbuilder » Anyone want to confirm that this is a bug?

Anyone want to confirm that this is a bug?


2008-04-18 11:12:19 PM
cppbuilder111
QC #61118: Linker does not notify about colliding names from different
libraries
I've tried to add an attachment that exhibits the behavior, but I can't seem
to do it with either the web client or the windows client. Any ideas?
Steps to reproduce:
Create a static library A
Create a new cpp unit in A
In the header, declare a class Y
In the cpp, declare a class X and have Y use X
Create a static library B
Create a new cpp unit in B
In the header, declare a class Z
In the cpp, declare a class X and have Z use X
Create a CPP VCL forms app
Include the headers from libraries A and B
Create a function F that uses both Y and Z
Build all.
Expected:
Linker will warn about a collision, or
Class Y will use X as defined in library A, and Class Z will use X as
defined in B.
Observed:
Linker does not warn, and
Class Y and class Z use X as defined in library A.
--
Matt Lowe
Milsoft Utility Solutions
 
 

Re:Anyone want to confirm that this is a bug?

Matt Lowe wrote:
Quote
I've tried to add an attachment that exhibits the behavior,
Any ideas?
Post attachments to borland.public.attachments
 

Re:Anyone want to confirm that this is a bug?

Done. Also corrected the steps to reproduce in the QC case. Library B should
be built like this:
Create a static library B
Create a new cpp unit in B
In the header, declare a class X and class Z
In the cpp, have Z use X
--
Matt Lowe
Milsoft Utility Solutions
"Bob Gonder" < XXXX@XXXXX.COM >wrote in message
Quote
Matt Lowe wrote:

>I've tried to add an attachment that exhibits the behavior,
>Any ideas?

Post attachments to borland.public.attachments


 

{smallsort}

Re:Anyone want to confirm that this is a bug?

Or not ... this attachment upload fails on the newsgroups too. It's a 4 MB
zip. I had included the binaries compiled on my machine, but maybe I'll
remove them and try again.
--
Matt Lowe
Milsoft Utility Solutions
"Matt Lowe" < XXXX@XXXXX.COM >wrote in message
Quote
Done. Also corrected the steps to reproduce in the QC case. Library B
should be built like this:

Create a static library B
Create a new cpp unit in B
In the header, declare a class X and class Z
In the cpp, have Z use X

--
Matt Lowe
Milsoft Utility Solutions

"Bob Gonder" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...
>Matt Lowe wrote:
>
>>I've tried to add an attachment that exhibits the behavior,
>>Any ideas?
>
>Post attachments to borland.public.attachments
>
>


 

Re:Anyone want to confirm that this is a bug?

The smaller zip worked. Uploaded to QC instead of the newsgroups. (why
duplicate?)
qc.codegear.com/wc/qcmain.aspx
--
Matt Lowe
Milsoft Utility Solutions
"Matt Lowe" < XXXX@XXXXX.COM >wrote in message
Quote
Or not ... this attachment upload fails on the newsgroups too. It's a 4 MB
zip. I had included the binaries compiled on my machine, but maybe I'll
remove them and try again.

--
Matt Lowe
Milsoft Utility Solutions

"Matt Lowe" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...
>Done. Also corrected the steps to reproduce in the QC case. Library B
>should be built like this:
>
>Create a static library B
>Create a new cpp unit in B
>In the header, declare a class X and class Z
>In the cpp, have Z use X
>
>--
>Matt Lowe
>Milsoft Utility Solutions
>
>"Bob Gonder" < XXXX@XXXXX.COM >wrote in message
>news: XXXX@XXXXX.COM ...
>>Matt Lowe wrote:
>>
>>>I've tried to add an attachment that exhibits the behavior,
>>>Any ideas?
>>
>>Post attachments to borland.public.attachments
>>
>>
>
>


 

Re:Anyone want to confirm that this is a bug?

"Matt Lowe" < XXXX@XXXXX.COM >wrote in message
Quote
Expected:
Linker will warn about a collision
I do not think there is a collison. You are defining two different Xs, each
one private for A and B separately. X has file scope (I think that is what
it is called) so code external to the file will never see it. A's X and B's
X should never be crossing paths. Now, if you have declared X inside of a
header file instead that both A and B use, then there would be a collison.
Quote
or Class Y will use X as defined in library A, and Class Z will
use X as defined in B.
I think that is what it is supposed to do.
Quote
Observed:
Linker does not warn
I don't think it should in this situation.
Quote
and Class Y and class Z use X as defined in library A.
That seems wrong.
Gambit
 

Re:Anyone want to confirm that this is a bug?

"Matt Lowe" < XXXX@XXXXX.COM >wrote in message
Quote
In the header, declare a class X and class Z
Ok, now you are creating a collison.
Gambit
 

Re:Anyone want to confirm that this is a bug?

"Matt Lowe" < XXXX@XXXXX.COM >wrote in message
Quote
Or not ... this attachment upload fails on the newsgroups too. It's
a 4 MB zip. I had included the binaries compiled on my machine,
but maybe I'll remove them and try again.
Yes, please don't post the binaries, just the source code. Make sure the
source is compilable.
Gambit
 

Re:Anyone want to confirm that this is a bug?

Matt Lowe wrote:
Quote
qc.codegear.com/wc/qcmain.aspx
I marked this as a duplicate of:
Report No: 57321 Status: Open
Class resolution conflict
qc.codegear.com/wc/qcmain.aspx
QCWIN:Defect_No=57321
If you don't agree that this is the same issue, please post back here.
- Leo
 

Re:Anyone want to confirm that this is a bug?

Yes, I think that issue is essentially the same. Thanks, Leo.
--
Matt Lowe
Milsoft Utility Solutions
"Leo Siefert" < XXXX@XXXXX.COM >wrote in message
Quote
Matt Lowe wrote:

>qc.codegear.com/wc/qcmain.aspx

I marked this as a duplicate of:

Report No: 57321 Status: Open
Class resolution conflict
qc.codegear.com/wc/qcmain.aspx
QCWIN:Defect_No=57321

If you don't agree that this is the same issue, please post back here.

- Leo