Charles Davis | f3f8d2a | 2010-02-18 02:00:42 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=gnu89 -fsyntax-only -verify %s |
Eli Friedman | 85a5319 | 2009-04-07 19:37:57 +0000 | [diff] [blame] | 2 | |
| 3 | // Check that we don't allow illegal uses of inline |
| 4 | inline int a; // expected-error{{'inline' can only appear on functions}} |
| 5 | typedef inline int b; // expected-error{{'inline' can only appear on functions}} |
| 6 | int d(inline int a); // expected-error{{'inline' can only appear on functions}} |
Charles Davis | f3f8d2a | 2010-02-18 02:00:42 +0000 | [diff] [blame] | 7 | |
| 8 | // PR5253 |
| 9 | // GNU Extension: check that we can redefine an extern inline function |
| 10 | extern inline int f(int a) {return a;} |
| 11 | int f(int b) {return b;} // expected-note{{previous definition is here}} |
| 12 | // And now check that we can't redefine a normal function |
| 13 | int f(int c) {return c;} // expected-error{{redefinition of 'f'}} |
| 14 | |
| 15 | // Check that we can redefine an extern inline function as a static function |
| 16 | extern inline int g(int a) {return a;} |
| 17 | static int g(int b) {return b;} |
| 18 | |
| 19 | // Check that we ensure the types of the two definitions are the same |
| 20 | extern inline int h(int a) {return a;} // expected-note{{previous definition is here}} |
| 21 | int h(short b) {return b;} // expected-error{{conflicting types for 'h'}} |
| 22 | |