[aligned_storage][repost] problems with GCC 4.0.0 20050309

The class aligned_storage in boost/aligned_storage.hpp has the following decl: template < std::size_t size_ , std::size_t alignment_ = std::size_t(-1)
class aligned_storage; GCC 4.0 complains about the default value for aligmnent_ saying that: '(size_t)((-1))' is not a valid template argument for type 'unsigned int' because it is a non-constant expression which is ruining some of the regression tests. Is GCC right or shall I submit a bug report at gcc.gnu.org/bugzilla? Thank you, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

JOAQUIN LOPEZ MU?Z wrote:
The class aligned_storage in boost/aligned_storage.hpp has the following decl:
template < std::size_t size_ , std::size_t alignment_ = std::size_t(-1)
class aligned_storage;
GCC 4.0 complains about the default value for aligmnent_ saying that:
'(size_t)((-1))' is not a valid template argument for type 'unsigned int' because it is a non-constant expression
which is ruining some of the regression tests. Is GCC right or shall I submit a bug report at gcc.gnu.org/bugzilla?
I don't see anything in the standard or in the issue lists that prohibits size_t(-1) as an integral constant expression. Bug report.

Would some kind sould please test the following in GCC 4.0.0 20050309? #include <cstddef> template< std::size_t size_, std::size_t alignment_ = std::size_t(-1)> struct aligned_storage { }; template<typename T> struct foo { aligned_storage<sizeof(T)> as; }; int main() { foo<double> f; } I'm trying to isolate the aligned_storage-problem with GCC 4.0 shown at: http://tinyurl.com/4hxy5 Thank you! Joaquín M López Muñoz Telefónica, Investigación y Desarrollo Peter Dimov ha escrito:
JOAQUIN LOPEZ MU?Z wrote:
The class aligned_storage in boost/aligned_storage.hpp has the following decl:
template < std::size_t size_ , std::size_t alignment_ = std::size_t(-1)
class aligned_storage;
GCC 4.0 complains about the default value for aligmnent_ saying that:
'(size_t)((-1))' is not a valid template argument for type 'unsigned int' because it is a non-constant expression
which is ruining some of the regression tests. Is GCC right or shall I submit a bug report at gcc.gnu.org/bugzilla?
I don't see anything in the standard or in the issue lists that prohibits size_t(-1) as an integral constant expression. Bug report.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Joaquín Mª López Muñoz wrote:
Would some kind sould please test the following in GCC 4.0.0 20050309?
#include <cstddef>
template< std::size_t size_, std::size_t alignment_ = std::size_t(-1)> struct aligned_storage { };
template<typename T> struct foo { aligned_storage<sizeof(T)> as; };
int main() { foo<double> f; }
I'm trying to isolate the aligned_storage-problem with GCC 4.0 shown at:
13: error: '(size_t)((-1))' is not a valid template argument for type 'unsigned int' because it is a non-constant expression Looks like you found a simple test case. Regards, m

GCC 4.0 complains about the default value for aligmnent_ saying that:
'(size_t)((-1))' is not a valid template argument for type 'unsigned int' because it is a non-constant expression
which is ruining some of the regression tests. Is GCC right or shall I submit a bug report at gcc.gnu.org/bugzilla?
I'm certain it's a bug: casts are permitted in integral constant expressions. John.
participants (5)
-
JOAQUIN LOPEZ MU?Z
-
Joaquín Mª López Muñoz
-
John Maddock
-
Martin Wille
-
Peter Dimov