The language feature known (by Microsoft, at least) as "terse static assert" - that is, a static_assert()
with only one argument - was introduced in the C++17 Standard. Before that, the second argument (a string literal, the error message) is required. So, compiling your code with (for example) MSVC and the "/std:C++14" flag, gives this error:
error C2429: language feature 'terse static assert' requires compiler
flag '/std:c++17'
And clang-cl gives:
warning : static_assert with no message is a C++17 extension
[-Wc++17-extensions]
To fix this, either switch your compiler to conform to the C++17 Standard or, if you don't have that possibility, add the required second argument:
static_assert(sizeof(uintptr_t) == sizeof(void*), "Wrong uintptr_t size!");
But note, even with that, there is no guarantee that the assertion will succeed! The uintptr_t
type is required only to be of sufficient size to correctly accommodate a pointer; it does not have to be the exact same size. See: What is uintptr_t data type.