llvm-capstone/clang/test/SemaTemplate/array-to-pointer-decay.cpp
Anna Zaks 148974d678 [analyzer] Fix a crash that occurs when processing an rvalue array.
When processing ArrayToPointerDecay, we expect the array to be a location, not a LazyCompoundVal.
Special case the rvalue arrays by using a location to represent them. This case is handled similarly
elsewhere in the code.

Fixes PR16206.

llvm-svn: 183359
2013-06-06 00:19:36 +00:00

39 lines
521 B
C++

// RUN: %clang_cc1 -fsyntax-only -verify %s
// expected-no-diagnostics
struct mystruct {
int member;
};
template <int i>
int foo() {
mystruct s[1];
return s->member;
}
int main() {
foo<1>();
}
// PR7405
struct hb_sanitize_context_t {
int start;
};
template <typename Type> static bool sanitize() {
hb_sanitize_context_t c[1];
return !c->start;
}
bool closure = sanitize<int>();
// PR16206
typedef struct {
char x[4];
} chars;
chars getChars();
void use(char *);
void test() {
use(getChars().x);
}