FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.brendan / crash62.C
blobc86f9e6bb4ac083250df9bfa5f806b7a2d7cf8d3
1 // Build don't link: 
2 // GROUPS passed old-abort
3 #include <iostream>
5         void
6         fubar(std::ostream* out, const char* s)
7         {
8           (*out) << s << std::endl;
9           return;
10         }
12         int
13         main()
14         {
15           // Declare a ref and a pointer to the same ostream.
16           //
17           std::ostream* out = &std::cerr;
18           std::ostream& die = std::cerr;
20           // Valid call to fubar.
21           //
22           fubar(out, "First line.");
23   
24           // Invalid call to fubar. (1st arg is an ostream&. fubar expects
25           // ostream*.)This should be a syntax error, but g++ does not catch it.
26           // Call to this function results in a bus error in fubar when the 1st
27           // arg is dereferenced.
28           //
29           fubar(die, "Second line.");// ERROR -  cannot convert .die.*
30   
31           return 1;
32         }