]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Sema/inline.c
Update clang to 97654.
[FreeBSD/FreeBSD.git] / test / Sema / inline.c
1 // RUN: %clang_cc1 -std=gnu89 -fsyntax-only -verify %s
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}}
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