Can someone explain to me why on Earth this piece of code refuses to work?
#include <cassert>
#include <type_traits>
using namespace std;
int main()
{
assert(is_same<int, int>::value);
}
Compilation error because, according to the compiler,
prog.cpp:7:33: error: macro "assert" passed 2 arguments, but takes just 1
assert(is_same<int, int>::value);
^
prog.cpp: In function 'int main()':
prog.cpp:7:2: error: 'assert' was not declared in this scope
assert(is_same<int, int>::value);
^
What? is_same<int, int>::valueundoubtedly is one of the arguments. Also declared in this area assert, and the compiler itself confirmed this in a previous error!
http://ideone.com/LcMVkn
source
share