Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.robertl/eb79.C

raw
1 // { dg-do assemble }
2 // { dg-prune-output "note" }
3 // { dg-skip-if "requires hosted libstdc++ for iostream" { ! hostedlib } }
4 // Makes bogus x86 assembly code.
5 #include <iostream>
6
7 // The VxWorks kernel-mode headers define a macro named "max", which is not
8 // ISO-compliant, but is part of the VxWorks API.
9 #if defined __vxworks && !defined __RTP__
10 #undef max
11 #endif
12
13 using namespace std;
14
15 template<class T>
16 T max(T a, T b)
17 {
18 return (a > b) ? a : b;
19 }
20
21 // Prototypes (enable one or the other)
22 double max<>(double, double); // { dg-error "" } bogus code
23 // int max(int, int);
24
25 int main()
26 {
27 int i = 123;
28 double d = 1234.5678;
29
30 cout.precision(12);
31 cout << max(d, i) << endl; // { dg-error "" }
32 cout << max(i, d) << endl; // { dg-error "" }
33 return 0;
34 }