cxx11-crashes.cpp revision 17eb65f1bfcc33d2a9ecefe32368cb374155dbdc
1// RUN: %clang_cc1 -analyze -analyzer-checker=core -std=c++11 -verify %s
2
3// radar://11485149, PR12871
4class PlotPoint {
5  bool valid;
6};
7
8PlotPoint limitedFit () {
9  PlotPoint fit0;
10  fit0 = limitedFit ();
11  return fit0;
12}
13
14// radar://11487541, NamespaceAlias
15namespace boost {namespace filesystem3 {
16class path {
17public:
18 path(){}
19};
20
21}}
22namespace boost
23{
24  namespace filesystem
25  {
26    using filesystem3::path;
27  }
28}
29
30void radar11487541() {
31  namespace fs = boost::filesystem;
32  fs::path p;
33}
34
35// PR12873 radar://11499139
36void testFloatInitializer() {
37  const float ysize={0.015}, xsize={0.01};
38}
39
40
41// PR12874, radar://11487525
42template<class T> struct addr_impl_ref {
43  T & v_;
44  inline addr_impl_ref( T & v ): v_( v ) {
45  }
46  inline operator T& () const {return v_;}
47};
48template<class T> struct addressof_impl {
49  static inline T * f( T & v, long )     {
50    return reinterpret_cast<T*>(&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
51  }
52};
53template<class T> T * addressof( T & v ) {
54  return addressof_impl<T>::f( addr_impl_ref<T>( v ), 0 );
55}
56void testRadar11487525_1(){
57  bool s[25];
58  addressof(s);
59}
60