Anna Zaks | 719b429 | 2012-05-18 22:47:43 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -analyze -analyzer-checker=core -std=c++11 -verify %s |
Andy Gibbs | 8e8fb3b | 2012-10-19 12:44:48 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
Anna Zaks | 719b429 | 2012-05-18 22:47:43 +0000 | [diff] [blame] | 3 | |
| 4 | // radar://11485149, PR12871 |
| 5 | class PlotPoint { |
| 6 | bool valid; |
| 7 | }; |
| 8 | |
| 9 | PlotPoint limitedFit () { |
| 10 | PlotPoint fit0; |
| 11 | fit0 = limitedFit (); |
| 12 | return fit0; |
| 13 | } |
Anna Zaks | 671e3bc | 2012-05-19 00:22:11 +0000 | [diff] [blame] | 14 | |
| 15 | // radar://11487541, NamespaceAlias |
| 16 | namespace boost {namespace filesystem3 { |
| 17 | class path { |
| 18 | public: |
| 19 | path(){} |
| 20 | }; |
| 21 | |
| 22 | }} |
| 23 | namespace boost |
| 24 | { |
| 25 | namespace filesystem |
| 26 | { |
| 27 | using filesystem3::path; |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | void radar11487541() { |
| 32 | namespace fs = boost::filesystem; |
| 33 | fs::path p; |
| 34 | } |
Anna Zaks | 13dd47a | 2012-05-21 22:07:00 +0000 | [diff] [blame] | 35 | |
Anna Zaks | 98553e8 | 2012-05-24 17:31:54 +0000 | [diff] [blame] | 36 | // PR12873 radar://11499139 |
Anna Zaks | 13dd47a | 2012-05-21 22:07:00 +0000 | [diff] [blame] | 37 | void testFloatInitializer() { |
| 38 | const float ysize={0.015}, xsize={0.01}; |
| 39 | } |
Anna Zaks | 17eb65f | 2012-05-24 17:31:57 +0000 | [diff] [blame] | 40 | |
| 41 | |
| 42 | // PR12874, radar://11487525 |
| 43 | template<class T> struct addr_impl_ref { |
| 44 | T & v_; |
| 45 | inline addr_impl_ref( T & v ): v_( v ) { |
| 46 | } |
| 47 | inline operator T& () const {return v_;} |
| 48 | }; |
| 49 | template<class T> struct addressof_impl { |
| 50 | static inline T * f( T & v, long ) { |
| 51 | return reinterpret_cast<T*>(&const_cast<char&>(reinterpret_cast<const volatile char &>(v))); |
| 52 | } |
| 53 | }; |
| 54 | template<class T> T * addressof( T & v ) { |
| 55 | return addressof_impl<T>::f( addr_impl_ref<T>( v ), 0 ); |
| 56 | } |
| 57 | void testRadar11487525_1(){ |
| 58 | bool s[25]; |
| 59 | addressof(s); |
| 60 | } |
Anna Zaks | e41458c | 2012-05-25 16:02:16 +0000 | [diff] [blame] | 61 | |
| 62 | // radar://11487525 Don't crash on CK_LValueBitCast. |
| 63 | bool begin(double *it) { |
| 64 | typedef bool type[25]; |
| 65 | bool *a = reinterpret_cast<type &>(*( reinterpret_cast<char *>( it ))); |
| 66 | return *a; |
| 67 | } |