Discussion:
bds2006 bug?
(too old to reply)
dhoke
2008-06-06 19:04:12 UTC
Permalink
With bds2006, the code further below produces the error:
Error E2285 bds2006_bug.cpp 21: Could not find a match for
'some_s::some_s(int (
*)[10])' in function otherfunc(some_s2 &)

line 21 is where itemb is being defined. I can see no difference between it
and itema, which does not generate an error, that should cause such an
error. (I have worked around this by declaring a second constructor taking
a pointer, and then de-referencing the pointer in the constructor
initialization list, since the rest of the class implementation was already
referencing the member reference variable.)

Someone, if they agree that it shouldn't produce this error, may wish to try
it with 2007, and report it if its still a problem.

=====================
struct some_s
{
int (&m_arr10x10)[10][10] ;
some_s(int (&p_arr10x10)[10][10])
: m_arr10x10( p_arr10x10 )
{
}
} ;
struct some_s2
{
int arr10x10[10][10] ;
} ;

void otherfunc(some_s2 &ans2)
{

int arr10x10[10][10] ;

some_s itema( arr10x10 ) ;

some_s itemb( ans2.arr10x10 ) ;

}
=====================
Leo Siefert
2008-06-09 11:56:02 UTC
Permalink
I think this is a known bug where the compiler inappropriately
collapses an array parameter to a pointer, but I will have to check to
make sure that this is actually a reported manifestation. Interesting
that it treats only one dimension of the array as a pointer.

- Leo
Fraser Ross
2008-06-09 19:39:11 UTC
Permalink
"Leo Siefert"
Post by Leo Siefert
Interesting
that it treats only one dimension of the array as a pointer.
I don't think thats abnormal.

The program appears to show the same bug with a one dimensional array.
If the 4 occurewnces of [10][10] are changed to [10] the bug is still
the same.

Fraser.
David Dean [CodeGear]
2008-06-14 01:38:01 UTC
Permalink
Post by dhoke
Someone, if they agree that it shouldn't produce this error, may wish to try
it with 2007, and report it if its still a problem.
It does fail to compile in RAD Studio 2007. It is a bug. I've logged
it.
--
David Dean (CodeGear)
Lead C++ QA Engineer
Loading...