aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/cxx11-crashes.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-05-24 17:31:57 +0000
committerAnna Zaks <ganna@apple.com>2012-05-24 17:31:57 +0000
commit17eb65f1bfcc33d2a9ecefe32368cb374155dbdc (patch)
treec531f2681d04625a81cec35450d73e9c88806e4a /test/Analysis/cxx11-crashes.cpp
parent98553e894111627ac0bd4a6972431f09ea37f2c1 (diff)
[analyzer] Treat cast of array to reference in the same way as array to
pointer. Fixes one of the crashes reported in PR12874. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157401 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/cxx11-crashes.cpp')
-rw-r--r--test/Analysis/cxx11-crashes.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/Analysis/cxx11-crashes.cpp b/test/Analysis/cxx11-crashes.cpp
index 2dc9b55293..8c68734da4 100644
--- a/test/Analysis/cxx11-crashes.cpp
+++ b/test/Analysis/cxx11-crashes.cpp
@@ -36,3 +36,24 @@ void radar11487541() {
void testFloatInitializer() {
const float ysize={0.015}, xsize={0.01};
}
+
+
+// PR12874, radar://11487525
+template<class T> struct addr_impl_ref {
+ T & v_;
+ inline addr_impl_ref( T & v ): v_( v ) {
+ }
+ inline operator T& () const {return v_;}
+};
+template<class T> struct addressof_impl {
+ static inline T * f( T & v, long ) {
+ return reinterpret_cast<T*>(&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
+ }
+};
+template<class T> T * addressof( T & v ) {
+ return addressof_impl<T>::f( addr_impl_ref<T>( v ), 0 );
+}
+void testRadar11487525_1(){
+ bool s[25];
+ addressof(s);
+}