2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.brendan / crash62.C
blob7147c9a8e6e035ecc4a22e6eac83986a091a96ae
1 // { dg-do assemble  }
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.");// { dg-error "" }  cannot convert .die.*
30   
31           return 1;
32         }