Hi,
what are the exact semantics of __attribute__((const)), when attached to a C++
class constructor, supposed to be?
My expectation was, that, since the ctor has a constructed object as return
value, the compiler is free, instead of calling a ctor twice for the case of
e.g.
Foo a(1);
Foo b(1);
, to do a memcopy of a to b after the a ctor is done.
Instead the result of using __attribute__((const)) is, that GCC feels free to
optimize the whole ctor away. Apparently the ctor is treated as a function
that returns void.
Do you rather want a bug report for the website documenting attribute const,
or for how GCC implements it? :-)
Cheers,
Matthias
--
Dipl.-Phys. Matthias Kretz
http://compeng.uni-frankfurt.de/index.php?id=mkretz