| 1 |
// { dg-do assemble } |
| 2 |
// { dg-additional-options -fpermissive } |
| 3 |
// { dg-skip-if "requires hosted libstdc++ for iostream" { ! hostedlib } } |
| 4 |
// GROUPS passed missed-error |
| 5 |
// missed-error file |
| 6 |
// From: [email protected] (Don Erway) |
| 7 |
// Date: Thu, 21 May 92 15:40:45 PDT |
| 8 |
// Subject: More on [g++ 2.1 : overloaded function selection incorrect] |
| 9 |
// Message-ID: <[email protected]> |
| 10 |
|
| 11 |
#include <iostream> |
| 12 |
|
| 13 |
// The VxWorks kernel-mode headers define a macro named "max", which is not |
| 14 |
// ISO-compliant, but is part of the VxWorks API. |
| 15 |
#if defined __vxworks && !defined __RTP__ |
| 16 |
#undef max |
| 17 |
#endif |
| 18 |
|
| 19 |
inline int max(int a, int b) {return a > b ? a : b;}; // { dg-message "note" } |
| 20 |
// { dg-error "extra ';'" "extra ;" { target c++98_only } .-1 } |
| 21 |
inline double max(double a, double b) {return a > b ? a : b;}; // { dg-message "note" } candidate |
| 22 |
// { dg-error "extra ';'" "extra ;" { target c++98_only } .-1 } |
| 23 |
|
| 24 |
int main() { |
| 25 |
// we treat this as-if extern |
| 26 |
static void foo(int i, int j, double x, double y) ;// { dg-error "" } .* |
| 27 |
|
| 28 |
foo(4, -37, 14.39, 14.38); |
| 29 |
} |
| 30 |
|
| 31 |
static void foo(int i, int j, double x, double y) // { dg-warning ".extern." } |
| 32 |
{ |
| 33 |
|
| 34 |
std::cout << "Max(int): " << max(i,j) << " Max(double): " << |
| 35 |
max(x,y) << '\n'; |
| 36 |
std::cout << "Max(int, double): " << max(i, y) << '\n';// { dg-error "" } |
| 37 |
} |
| 38 |
|