// C99 5.1.1.2p2: If the file is non-empty and didn't end in a newline, issue
// a pedwarn.
- if (CurPtr != BufferStart && (CurPtr[-1] != '\n' && CurPtr[-1] != '\r'))
+ if (CurPtr != BufferStart && (CurPtr[-1] != '\n' && CurPtr[-1] != '\r')
+ && !LangOpts.CPlusPlus0x) // C++11 [lex.phases] 2.2 p2
Diag(BufferEnd, diag::ext_no_newline_eof)
<< FixItHint::CreateInsertion(getSourceLocation(BufferEnd), "\n");
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wnewline-eof -verify %s
+
+// The following line isn't terminated, don't fix it.
+void foo() {}
\ No newline at end of file
-// RUN: %clang -fsyntax-only -Wnewline-eof -verify %s
+// RUN: %clang -cc1 -fsyntax-only -Wnewline-eof -verify %s
// rdar://9133072
// The following line isn't terminated, don't fix it.
-void foo() {} // expected-warning{{No newline at end of file}}
\ No newline at end of file
+void foo() {} // expected-warning{{no newline at end of file}}
\ No newline at end of file