Daily bump.
[gcc.git] / gcc / testsuite / g++.dg / analyzer / cstdlib-2.C
blob0dedf8aef5c10f37aaa1b129ed4018e2b72c7876
1 /* Manual reimplemenation of <cstdlib>, to test name-matching within std.  */
3 namespace std
5   typedef __SIZE_TYPE__ size_t;
6   void *malloc (std::size_t size);
7   void *calloc (std::size_t num, std::size_t size);
8   void free (void *ptr);
11 void test_1 (void *ptr)
13   std::free (ptr); /* { dg-message "first 'free' here" } */
14   std::free (ptr); /* { dg-warning "double-'free' of 'ptr'" } */
17 void test_2 (void)
19   void *p = std::malloc (1024); /* { dg-message "allocated here" } */
20 } /* { dg-warning "leak of 'p'" } */
22 void test_3 (void)
24   void *p = std::calloc (42, 1024); /* { dg-message "allocated here" } */
25 } /* { dg-warning "leak of 'p'" } */