Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -Wmissing-prototypes %s |
Anders Carlsson | 9f89dd7 | 2009-12-09 03:30:09 +0000 | [diff] [blame] | 2 | |
| 3 | void f() { } // expected-warning {{no previous prototype for function 'f'}} |
| 4 | |
| 5 | namespace NS { |
| 6 | void f() { } // expected-warning {{no previous prototype for function 'f'}} |
| 7 | } |
| 8 | |
| 9 | namespace { |
Anders Carlsson | 63fb673 | 2009-12-09 03:44:46 +0000 | [diff] [blame] | 10 | // Don't warn about functions in anonymous namespaces. |
Anders Carlsson | 9f89dd7 | 2009-12-09 03:30:09 +0000 | [diff] [blame] | 11 | void f() { } |
| 12 | } |
| 13 | |
| 14 | struct A { |
Anders Carlsson | 63fb673 | 2009-12-09 03:44:46 +0000 | [diff] [blame] | 15 | // Don't warn about member functions. |
Anders Carlsson | 9f89dd7 | 2009-12-09 03:30:09 +0000 | [diff] [blame] | 16 | void f() { } |
| 17 | }; |
| 18 | |
Anders Carlsson | 63fb673 | 2009-12-09 03:44:46 +0000 | [diff] [blame] | 19 | // Don't warn about inline functions. |
| 20 | inline void g() { } |
| 21 | |
| 22 | // Don't warn about function templates. |
| 23 | template<typename> void h() { } |
| 24 | |
| 25 | // Don't warn when instantiating function templates. |
| 26 | template void h<int>(); |
John McCall | 850d3b3 | 2011-03-22 07:16:37 +0000 | [diff] [blame] | 27 | |
| 28 | // PR9519: don't warn about friend functions. |
| 29 | class I { |
| 30 | friend void I_friend() {} |
| 31 | }; |
| 32 | |