Index: lib/Sema/SemaDecl.cpp =================================================================== --- lib/Sema/SemaDecl.cpp +++ lib/Sema/SemaDecl.cpp @@ -6186,6 +6186,9 @@ Diag(D.getDeclSpec().getInlineSpecLoc(), diag::err_inline_declaration_block_scope) << Name << FixItHint::CreateRemoval(D.getDeclSpec().getInlineSpecLoc()); + } else if (!getLangOpts().CPlusPlus) { + Diag(D.getDeclSpec().getInlineSpecLoc(), diag::err_inline_non_function) + << 0; } else { Diag(D.getDeclSpec().getInlineSpecLoc(), getLangOpts().CPlusPlus1z ? diag::warn_cxx14_compat_inline_variable Index: test/Sema/inline.c =================================================================== --- test/Sema/inline.c +++ test/Sema/inline.c @@ -49,7 +49,7 @@ #include "inline.c" // Check that we don't allow illegal uses of inline -inline int a; // expected-warning{{inline variables are a C++1z extension}} +inline int a; // expected-error{{'inline' can only appear on functions}} typedef inline int b; // expected-error{{'inline' can only appear on functions}} int d(inline int a); // expected-error{{'inline' can only appear on functions}}