inline.c revision f3f8d2a52ebc0acbe6269a0302f90c21668e2404
1// RUN: %clang_cc1 -std=gnu89 -fsyntax-only -verify %s
2
3// Check that we don't allow illegal uses of inline
4inline int a; // expected-error{{'inline' can only appear on functions}}
5typedef inline int b; // expected-error{{'inline' can only appear on functions}}
6int d(inline int a); // expected-error{{'inline' can only appear on functions}}
7
8// PR5253
9// GNU Extension: check that we can redefine an extern inline function
10extern inline int f(int a) {return a;}
11int f(int b) {return b;} // expected-note{{previous definition is here}}
12// And now check that we can't redefine a normal function
13int 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
16extern inline int g(int a) {return a;}
17static int g(int b) {return b;}
18
19// Check that we ensure the types of the two definitions are the same
20extern inline int h(int a) {return a;} // expected-note{{previous definition is here}}
21int h(short b) {return b;}  // expected-error{{conflicting types for 'h'}}
22
23