fork download
  1. #include <cassert>
  2. #include <iostream>
  3. #include <utility>
  4. using namespace std;
  5.  
  6. struct base { virtual ~base() {} };
  7.  
  8. template <typename T>
  9. struct Foo : base { T foo; };
  10.  
  11. int main() {
  12. base* test = new Foo<pair<int, int>>;
  13.  
  14. assert(dynamic_cast<Foo<pair<int, int>>*>(test) != NULL);
  15.  
  16. if(dynamic_cast<Foo<pair<int, int>>*>(test) != NULL) cout << "hello world\n";
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:14:57: error: macro "assert" passed 2 arguments, but takes just 1
  assert(dynamic_cast<Foo<pair<int, int>>*>(test) != NULL);
                                                         ^
prog.cpp: In function 'int main()':
prog.cpp:14:2: error: 'assert' was not declared in this scope
  assert(dynamic_cast<Foo<pair<int, int>>*>(test) != NULL);
  ^
stdout
Standard output is empty