blob: b4795d3d936f6ba895c17f787868586ab65d0f4b [file] [log] [blame]
Charles Davisf3f8d2a2010-02-18 02:00:42 +00001// RUN: %clang_cc1 -std=gnu89 -fsyntax-only -verify %s
Eli Friedman85a53192009-04-07 19:37:57 +00002
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}}
Charles Davisf3f8d2a2010-02-18 02:00:42 +00007
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