[repost][aligned_storage] problem for GCC 3.2 and proposed solution

Allow me to repost this, since seems it has gone thru the list indavertently. I'd be grateful if people with various versions of GCC can try the snippet so as to determine to which extent the problem shows. Original post follows: The following program: #include <boost/aligned_storage.hpp> struct foo { foo(int x){} private: boost::aligned_storage<sizeof(int)> a; }; int main() { foo f(5); return 0; } fails in GCC 3.2 20020927 with the error: /usr/local/boost_1_32_0/boost/aligned_storage.hpp: In function `int main()': /usr/local/boost_1_32_0/boost/aligned_storage.hpp:75: ` boost::aligned_storage<size_, alignment_>::aligned_storage(const boost::aligned_storage<size_, alignment_>&) [with unsigned int size_ = 4, unsigned int alignment_ = 0ffffffff]' is private Digging into aligned_storage.hpp, I find the following workaround: #if !BOOST_WORKAROUND(__GNUC__, <= 2) private: // noncopyable aligned_storage(const aligned_storage&); aligned_storage& operator=(const aligned_storage&); #else // gcc2.x public: // _should_ be noncopyable, but GCC compiler emits error aligned_storage(const aligned_storage&); aligned_storage& operator=(const aligned_storage&); #endif // gcc2.x workaround So, it seems like the problem was known but incorrectly assumed to affect GCC 2.x only. Anyone objects to extending the workaround to GCC 3.x? It remains to know whether this problem (that seems like an incorrect application of the copy ellision rules) persists in GCC 3.4.x, and in case it is fixed, which last version is for which we should have the workaround. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

On Sun, 28 Nov 2004 23:03:43 +0100 JOAQUIN LOPEZ MU?Z <joaquin@tid.es> wrote:
Allow me to repost this, since seems it has gone thru the list indavertently. I'd be grateful if people with various versions of GCC can try the snippet so as to determine to which extent the problem shows.
g++ (GCC) 3.3.3 (SuSE Linux) compiles clean, with neither warnings or errors

On Sun, Nov 28, 2004 at 11:03:43PM +0100, JOAQUIN LOPEZ MU?Z wrote:
Allow me to repost this, since seems it has gone thru the list indavertently. I'd be grateful if people with various versions of GCC can try the snippet so as to determine to which extent the problem shows.
Original post follows:
The following program:
#include <boost/aligned_storage.hpp>
struct foo { foo(int x){}
private: boost::aligned_storage<sizeof(int)> a; };
int main() { foo f(5);
return 0; }
fails in GCC 3.2 20020927 with the error:
[...] Your program compiles fine here with g++ 3.2.3, 3.3.1, and 3.4.2. If the bug was indeed fixed within the 3.2 release series then it is likely it was a regression. But I don't have gcc 3.0 and 3.1 installed anymore so I cannot test those compilers. Christoph -- http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/cludwig.html LiDIA: http://www.informatik.tu-darmstadt.de/TI/LiDIA/Welcome.html
participants (3)
-
Christoph Ludwig
-
JOAQUIN LOPEZ MU?Z
-
Jody Hagins