Index: lib/Lex/Pragma.cpp =================================================================== --- lib/Lex/Pragma.cpp +++ lib/Lex/Pragma.cpp @@ -193,7 +193,7 @@ if (!tok::isStringLiteral(Tok.getKind())) { Diag(PragmaLoc, diag::err__Pragma_malformed); // Skip this token, and the ')', if present. - if (Tok.isNot(tok::r_paren)) + if (Tok.isNot(tok::eof) && Tok.isNot(tok::r_paren)) Lex(Tok); if (Tok.is(tok::r_paren)) Lex(Tok); Index: test/Preprocessor/_Pragma.c =================================================================== --- test/Preprocessor/_Pragma.c +++ test/Preprocessor/_Pragma.c @@ -11,3 +11,5 @@ #ifdef macro #error #define invalid #endif + +_Pragma( // expected-error {{_Pragma takes a parenthesized string literal}}