Bug?
Carlo Wood
carlo@alinoe.com
Wed Mar 8 14:14:00 GMT 2000
Hmmpf. Almost always when I feel doubt it turns out I am wrong :(.
So I hestitate to send you anything that I didn't dig into myself
first for a while... but there is little digging into this :/.
Still I feel doubt though. Is this a bug? I appologise if it isn't.
>g++ -c 20000308.cc
20000308.cc: In method `A::A(const int (&)[4])':
20000308.cc:9: incompatible types in assignment of `const int[4]' to `int[4]'
>cat 20000308.cc
struct A {
int a[4];
A(int const (&b)[4]);
};
A::A(int const (&b)[4])
/* : a(b) */ // (<-- gives same error)
{
a = b;
}
The reason I think it is a bug, is because I'd expect the
complete array to be copied:
for (int i = 0; i < 4; ++i)
a[i] = b[i];
works fine, as does:
memcpy(a, b, sizeof(a));
so why doesn't a = b; ?
--
Carlo Wood <carlo@alinoe.com>
More information about the Gcc-bugs
mailing list