This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20453] GCC fails to treat a valid constant expression as a template argument
- From: "joaquin at tid dot es" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Mar 2005 17:08:27 -0000
- Subject: [Bug c++/20453] GCC fails to treat a valid constant expression as a template argument
- References: <20050313132811.20453.joaquin@tid.es>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From joaquin at tid dot es 2005-03-14 17:08 -------
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > I cannot reproduce it either with an obvious change to fix the missing
> >
> > Too bad. Sorry for reporting this in such an imprecise
> > manner. The actual problem shows at Boost regression tests
> >
OK, I've got a test case:
#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;
}
Fails with the following:
13: error: '(size_t)((-1))' is not a valid template argument for type 'unsigned
int' because it is a non-constant expression
Regards,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20453