https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105808

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Removing the include:
using size_t = decltype(sizeof(0));

template<typename>
struct extent
{
    static constexpr size_t value = 0;
};

template<typename T, size_t size>
struct extent<T[size]>
{
    static constexpr size_t value = size;
};

static_assert(extent<char[1ULL << 32]>::value != 0, "");  // fails
----- CUT ----

GCC 7 and before used to error out about the overflow:
<source>: In substitution of 'template<class T, long unsigned int size> struct
extent<T [size]> [with T = char; long unsigned int size = 0]':
<source>:15:39:   required from here
<source>:15:39: error: overflow in constant expression
 static_assert(extent<char[1ULL << 32]>::value != 0, "");  // fails
                                       ^~

clang accepts the code as being valid ...

Reply via email to