aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.dg/Wbuiltin_declaration_mismatch1.d
blob: 53406474a851cc54331b1134f9dec919b60d106f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// { dg-do compile }
// { dg-options "-Wbuiltin-declaration-mismatch" }

extern(C):

// Mismatched parameter lengths
double tan();             // { dg-warning "\\\[-Wbuiltin-declaration-mismatch]" }

// Mismatched variadic arguments
int printf(const(char)*); // { dg-warning "\\\[-Wbuiltin-declaration-mismatch]" }

// Mismatched return type
void puts(char*);         // { dg-warning "\\\[-Wbuiltin-declaration-mismatch]" }

// Mismatched return storage class
ref int isalnum(int);     // { dg-warning "\\\[-Wbuiltin-declaration-mismatch]" }

// Mismatched parameter type
double sin(long);         // { dg-warning "\\\[-Wbuiltin-declaration-mismatch]" }

// Mismatched parameter storage class
double frexp(double, lazy int*); // { dg-warning "\\\[-Wbuiltin-declaration-mismatch]" }
double log(ref double);          // { dg-warning "\\\[-Wbuiltin-declaration-mismatch]" }

// Verify that storage classes don't affect covariance matching
@trusted nothrow @nogc pure double fabs(double);

// Verify inout is allowed instead of const
inout(char)* strstr(return scope inout(char)*, scope const char*) pure;

// Verify that FILE* is allowed as it is implicitly convertable to void*
struct _IO_FILE{}
alias FILE = shared(_IO_FILE);
int fprintf(FILE*, scope const char*, scope const ...);

// Verify integral types with same size are treated as if equivalent
int putchar(dchar);