Debian Codegraph @

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

raw
1 // { dg-do run }
2 // GROUPS passed arg-matching
3 // arg-matching file
4 // Message-Id: <[email protected]>
5 // From: Dan Franklin <[email protected]>
6 // Subject: overloaded function resolved incorrectly
7 // Date: Tue, 4 May 93 13:59:18 EDT
8
9 #include <stdio.h>
10
11 // Given the following overloaded function definitions
12
13 int ovf(unsigned long, short, short) { printf ("PASS\n"); return 0; }
14 int ovf( int, short, unsigned long) { printf ("FAIL\n"); return 1; }
15
16 // and the call
17 //
18 // ovf(unsigned long, unsigned int, unsigned int)
19 //
20 // it seems to me (and to cfront) that this should resolve to ovf #1 above,
21 // but g++ resolves it to ovf #2. Resolving to ovf #1 requires two conversions
22 // (unsigned int => short) while resolving to ovf #2 takes two conversions
23 // (unsigned long => int, unsigned int => short) and a promotion
24 // (unsigned int => unsigned long).
25
26 int main(int, char**)
27 {
28 unsigned long pixmap = 0;
29 unsigned int x = 0;
30 unsigned int y = 0;
31
32 return ovf(pixmap, x, y);
33 }