1// { dg-do assemble } 2// GROUPS passed old-abort 3#include <iostream> 4 5 void 6 fubar(std::ostream* out, const char* s) 7 { 8 (*out) << s << std::endl; 9 return; 10 } 11 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; 19 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 } 33