1// { dg-do assemble  }
2// GROUPS passed missed-error
3// missed-error file
4// From: ndc!don@csvax.cs.caltech.edu (Don Erway)
5// Date:     Thu, 21 May 92 15:40:45 PDT
6// Subject:  More on [g++ 2.1 : overloaded function selection incorrect]
7// Message-ID: <9205212240.AA17934@ndc.com>
8
9#include <iostream>
10
11// The VxWorks kernel-mode headers define a macro named "max", which is not
12// ISO-compliant, but is part of the VxWorks API.
13#if defined __vxworks && !defined __RTP__
14#undef max
15#endif
16
17inline int max(int a, int b) {return a > b ? a : b;}; // { dg-message "note" }
18 // { dg-error "extra ';'" "extra ;" { target *-*-* } 17 }
19inline double max(double a, double b) {return a > b ? a : b;}; // { dg-message "note" } candidate
20 // { dg-error "extra ';'" "extra ;" { target *-*-* } 19 }
21
22int main() {
23   static void foo(int i, int j, double x, double y) ;// { dg-error "" } .*
24
25   foo(4, -37, 14.39, 14.38);
26}
27
28// 971006 we no longer give an error for this since we emit a hard error
29// about the declaration above
30static void foo(int i, int j, double x, double y) {
31
32   std::cout << "Max(int): " << max(i,j) << " Max(double): " <<
33max(x,y) << '\n';
34   std::cout << "Max(int, double): " << max(i, y) << '\n';// { dg-error "" }
35}
36
37