minix/external/bsd/llvm/dist/clang/test/Sema/warn-sizeof-arrayarg.c
Lionel Sambuc f4a2713ac8 Importing netbsd clang -- pristine
Change-Id: Ia40e9ffdf29b5dab2f122f673ff6802a58bc690f
2014-07-28 17:05:57 +02:00

30 lines
1,000 B
C

// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef int Arr[10];
typedef int trungl_int;
void f(int a[10], Arr arr) { // \
// expected-note {{declared here}} \
// expected-note {{declared here}} \
// expected-note {{declared here}} \
// expected-note {{declared here}}
/* Should warn. */
(void)sizeof(a); // \
// expected-warning{{sizeof on array function parameter will return size of 'int *' instead of 'int [10]'}}
(void)sizeof((((a)))); // \
// expected-warning{{sizeof on array function parameter will return size of 'int *' instead of 'int [10]'}}
(void)sizeof a; // \
// expected-warning{{sizeof on array function parameter will return size of 'int *' instead of 'int [10]'}}
(void)sizeof arr; // \
// expected-warning{{sizeof on array function parameter will return size of 'int *' instead of 'Arr' (aka 'int [10]')}}
/* Shouldn't warn. */
int b[10];
(void)sizeof b;
Arr brr;
(void)sizeof brr;
(void)sizeof(Arr);
(void)sizeof(int);
}