blob: 6b033fc3a21f8c6e3a0c905705b821a3508b3368 [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc -fsyntax-only -verify %s
Douglas Gregor2224f842009-02-25 16:33:18 +00002
3// C DR #316, PR 3626.
4void f0(a, b, c, d) int a,b,c,d; {}
Douglas Gregor74734d52009-04-02 15:37:10 +00005void t0(void) {
6 f0(1); // expected-warning{{too few arguments}}
7}
Douglas Gregor2224f842009-02-25 16:33:18 +00008
9void f1(a, b) int a, b; {}
Douglas Gregor74734d52009-04-02 15:37:10 +000010void t1(void) {
11 f1(1, 2, 3); // expected-warning{{too many arguments}}
12}
Douglas Gregor2224f842009-02-25 16:33:18 +000013
14void f2(float); // expected-note{{previous declaration is here}}
Douglas Gregorc8376562009-03-06 22:43:54 +000015void f2(x) float x; { } // expected-warning{{promoted type 'double' of K&R function parameter is not compatible with the parameter type 'float' declared in a previous prototype}}
Douglas Gregor2224f842009-02-25 16:33:18 +000016
17typedef void (*f3)(void);
18f3 t3(int b) { return b? f0 : f1; } // okay