Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7957 Discussions

std::bad_cast thrown at runtime only w/ Intel OS X C++ compiler

jcoffland
Beginner
334 Views
dynamic_cast fails on standard template type with OS X Intel C++ compiler but works fine with Intel Linux or Windows C++ compilers as well as with GNU gcc and Windows Visual Studio. Here is a simple program that demonstrates the bug:
[cpp]#include 

int main(int argc, char *argv[]) {
  std::ostringstream ss;
  std::ostream &stream = ss;

  std::ostringstream &ref = dynamic_cast<:OSTRINGSTREAM>(stream); 

  return 0;
}
[/cpp]
The above code should not throw 'std::bad_cast' at run-time.
Compiler version:icpc (ICC) 11.1 20100401
Command line:icpc -o test test.cpp
0 Kudos
1 Reply
Dale_S_Intel
Employee
334 Views
It looks like it's a problem unique to 10.6 (Snow Leopard). I'll investigate and see what I can figure out. I'll post here with any updates.

Thanks!
Dale
0 Kudos
Reply