sdm@cs.brown.edu (Scott Meyers) (03/23/90)
Okay, so mystifying error messages are nothing to get excited about, but
this one is so good I thought it might be of wider interest. Try
passing a stream by value:
#include <iostream.h>
void foo( ostream s ) // Oops -- meant ostream&
{
s << "Foo!";
}
main()
{
foo( cout );
}
Here's the error message:
"streamvalue.C", line 11: error:
ostream::ostream() cannot access ios::ios(): private member
Things to note:
1. The line number given is the last line of the file.
2. One is left wondering how it is that one is trying to call a
private constructor.
3. One begins to wonder why a constructor is private in the first
place...
Perhaps the error message gurus at AT&T could look into improving this
kind of behavior in 2.1?
Scott
sdm@cs.brown.edu