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