Boost logo

Boost Testing :

From: Jonathan Wakely (cow_at_[hidden])
Date: 2005-03-01 09:14:46


On Tue, Mar 01, 2005 at 03:59:36AM -0600, Aleksey Gurtovoy wrote:

> Jeff Garland writes:
> > I realize this is an experimental compiler, but I notice date-time
> > isn't building because of an MPL failure. Similar problem in the
> > MPL tests. I looked at the code, but I have no idea what the
> > problem could be, possibly something simple?
>
> Just looked into it, and it appears to be a GCC bug: they seem to
> disallow any cast notation in integral constant expressions, while
> section 5.19 [expr.const] para 1 explicitly allows type conversions to
> integral or enumeration types:
>
> [...] Floating literals (2.13.3) can appear only if they are cast to
> integral or enumeration types. Only type conversions to integral or
> enumeration types can be used. [...]
>
> If you could verify that the following stripped down version of the
> code in question is rejected, I'd submit a corresponding bug report:
>
> template< int n > struct int_ {};
> typedef int_< static_cast<int>(5) > n;

This is the minimum that fails:

    template<typename T, T N> struct int_ {
        static const T value = N;
        typedef int_< T, static_cast<T>(value+1) > next;
    };

GCC compiles this if you use "n" in the integral constant expression,
rather than "value"

    typedef int_< T, static_cast<T>(N+1) > next;

I'll file a GCC PR

jon

-- 
"Malt does more than Milton can
 To justify God's ways to man."
	- Housman, A. E. (1859 - 1936)

Boost-testing list run by mbergal at meta-comm.com