aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Analysis/engine/gh151711.cpp
blob: a9950a7a3b9d07d51d345944c4ddcd9983cc000e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s
// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify -x c %s

void clang_analyzer_dump(int);

// Ensure that VLA types are correctly handled by unary type traits in the
// expression engine. Previously, __datasizeof and _Countof both caused failed
// assertions.
void gh151711(int i) {
  clang_analyzer_dump(sizeof(int[i++]));       // expected-warning {{Unknown}}
#ifdef __cplusplus
  // __datasizeof is only available in C++.
  clang_analyzer_dump(__datasizeof(int[i++])); // expected-warning {{Unknown}}
#else
  // _Countof is only available in C.
  clang_analyzer_dump(_Countof(int[i++]));     // expected-warning {{Unknown}}
#endif
}