diff options
Diffstat (limited to 'test/Analysis/casts.cpp')
-rw-r--r-- | test/Analysis/casts.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/Analysis/casts.cpp b/test/Analysis/casts.cpp new file mode 100644 index 0000000000..046ffb53c8 --- /dev/null +++ b/test/Analysis/casts.cpp @@ -0,0 +1,36 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify %s + +void fill_r (int * const &x); + +char testPointer () { + int x[8]; + int *xp = x; + fill_r(xp); + + return x[0]; // no-warning +} + +char testArray () { + int x[8]; + fill_r(x); + + return x[0]; // no-warning +} + +char testReferenceCast () { + int x[8]; + int *xp = x; + fill_r(reinterpret_cast<int * const &>(xp)); + + return x[0]; // no-warning +} + + +void fill (int *x); +char testReferenceCastRValue () { + int x[8]; + int *xp = x; + fill(reinterpret_cast<int * const &>(xp)); + + return x[0]; // no-warning +} |