Why is this "call" to assert seeing two arguments instead of just the one?

Viewed 701

Given this test program:

#include <cassert>
#include <string>
#include <type_traits>

const std::string& const_string = "bla";
std::string const & string_const = "blabla";

static_assert(std::is_same<decltype(const_string), decltype(string_const)>::value, "Uhoh");

int main()
{
    assert(std::is_same<decltype(const_string), decltype(string_const)>::value);
}

Which asserts that two types are the same at compile-time and at runtime using C's assert. All of Clang, MSVC2015, and GCC report the same error, so I'm quite sure it's me:

main.cpp:13:49: error: too many arguments provided to function-like macro invocation
    assert(std::is_same<decltype(const_string), decltype(string_const)>::value);
                                                ^
/usr/include/assert.h:91:10: note: macro 'assert' defined here
# define assert(expr)                                                   \
         ^

I'm just not seeing two arguments in the assert. What's more, the static_assert works just fine... So what is going on here?

2 Answers
Related