Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.law/arg8.C

raw
1 // { dg-do run }
2 // { dg-skip-if "requires hosted libstdc++ for iostream" { ! hostedlib } }
3 // GROUPS passed arg-matching
4 // arg-matching file
5 // Message-Id: <9307081747.AA14030@tnt>
6 // From: [email protected] (Mark A. McLaughlin)
7 // Subject: g++ bug
8 // Date: Thu, 8 Jul 93 11:47:28 MDT
9
10
11 #include <iostream>
12 #include <cstdio>
13
14 // With this declaration the program will not link.
15 template <class Type> std::ostream & save(std::ostream & os, Type T);
16
17 template <class Type> std::ostream &
18 save(std::ostream & os, Type T) {
19 return os << T;
20 } // save
21
22 int
23 main() {
24 int i = 10;
25 save((std::ostream &)std::cout, i) << std::endl;
26 short int s = 5;
27 save((std::ostream &)std::cout, s) << std::endl;
28 std::printf ("PASS\n");
29 } // main