[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / warn-sizeof-arrayarg.c
blob7c1a9a282161750beb423a5c319c030affa9ff67
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 typedef int Arr[10];
5 typedef int trungl_int;
7 void f(int a[10], Arr arr) { // expected-note 4 {{declared here}}
9 /* Should warn. */
10 (void)sizeof(a); // \
11 // expected-warning{{sizeof on array function parameter will return size of 'int *' instead of 'int[10]'}}
12 (void)sizeof((((a)))); // \
13 // expected-warning{{sizeof on array function parameter will return size of 'int *' instead of 'int[10]'}}
14 (void)sizeof a; // \
15 // expected-warning{{sizeof on array function parameter will return size of 'int *' instead of 'int[10]'}}
16 (void)sizeof arr; // \
17 // expected-warning{{sizeof on array function parameter will return size of 'int *' instead of 'Arr' (aka 'int[10]')}}
19 /* Shouldn't warn. */
20 int b[10];
21 (void)sizeof b;
22 Arr brr;
23 (void)sizeof brr;
24 (void)sizeof(Arr);
25 (void)sizeof(int);