Crash with 'cout << "";'

Richard Atterer atterer@informatik.tu-muenchen.de
Tue Oct 19 01:03:00 GMT 1999


/*
Hello,

I've been able to isolate another problem with outputting zero-length
things - this time a zero-length character constant. I'm using gcc
2.95.1 19990816 and libstdc++ 2.90.6.1

Cheers,

  Richard

*/
#include <iostream>

struct Out { } out;

ostream& operator<<(ostream& s, const Out) {
  return s; // executes OK
}

int main() {
  cout << out << endl;
  cout << ""; // segfault here if string empty
  return 0;
}
/*
-- 
  __   _
  |_) /|  Richard Atterer (currently at Queen's University, Belfast, NI)
  | \/¯|  http://www.in.tum.de/~atterer/
  ¯ ´` ¯
*/



More information about the Libstdc++ mailing list