1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -verify -fsyntax-only -Werror
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuc typedef int int32_t;
4*f4a2713aSLionel Sambuc typedef unsigned char Boolean;
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuc extern int printf(__const char *__restrict __format, ...); // expected-note{{'printf' declared here}}
7*f4a2713aSLionel Sambuc
func()8*f4a2713aSLionel Sambuc void func() {
9*f4a2713aSLionel Sambuc int32_t *vector[16];
10*f4a2713aSLionel Sambuc const char compDesc[16 + 1];
11*f4a2713aSLionel Sambuc int32_t compCount = 0;
12*f4a2713aSLionel Sambuc if (_CFCalendarDecomposeAbsoluteTimeV(compDesc, vector, compCount)) { // expected-note {{previous implicit declaration is here}} \
13*f4a2713aSLionel Sambuc expected-error {{implicit declaration of function '_CFCalendarDecomposeAbsoluteTimeV' is invalid in C99}}
14*f4a2713aSLionel Sambuc }
15*f4a2713aSLionel Sambuc
16*f4a2713aSLionel Sambuc printg("Hello, World!\n"); // expected-error{{implicit declaration of function 'printg' is invalid in C99}} \
17*f4a2713aSLionel Sambuc // expected-note{{did you mean 'printf'?}}
18*f4a2713aSLionel Sambuc
19*f4a2713aSLionel Sambuc __builtin_is_les(1, 3); // expected-error{{use of unknown builtin '__builtin_is_les'}}
20*f4a2713aSLionel Sambuc }
_CFCalendarDecomposeAbsoluteTimeV(const char * componentDesc,int32_t ** vector,int32_t count)21*f4a2713aSLionel Sambuc Boolean _CFCalendarDecomposeAbsoluteTimeV(const char *componentDesc, int32_t **vector, int32_t count) { // expected-error{{conflicting types for '_CFCalendarDecomposeAbsoluteTimeV'}}
22*f4a2713aSLionel Sambuc return 0;
23*f4a2713aSLionel Sambuc }
24*f4a2713aSLionel Sambuc
25*f4a2713aSLionel Sambuc
26*f4a2713aSLionel Sambuc // Test the typo-correction callback in Sema::ImplicitlyDefineFunction
27*f4a2713aSLionel Sambuc extern int sformatf(char *str, __const char *__restrict __format, ...); // expected-note{{'sformatf' declared here}}
test_implicit()28*f4a2713aSLionel Sambuc void test_implicit() {
29*f4a2713aSLionel Sambuc int formats = 0;
30*f4a2713aSLionel Sambuc formatd("Hello, World!\n"); // expected-error{{implicit declaration of function 'formatd' is invalid in C99}} \
31*f4a2713aSLionel Sambuc // expected-note{{did you mean 'sformatf'?}}
32*f4a2713aSLionel Sambuc }
33