[clang] ced7617 - PR45267: Don't reject pure-specifiers with escaped newlines in their '0' token.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 20 18:45:06 PDT 2020
Author: Richard Smith
Date: 2020-03-20T18:44:55-07:00
New Revision: ced7617c3853d19ffa00a578e92ffd7c54b6c2fb
URL: https://github.com/llvm/llvm-project/commit/ced7617c3853d19ffa00a578e92ffd7c54b6c2fb
DIFF: https://github.com/llvm/llvm-project/commit/ced7617c3853d19ffa00a578e92ffd7c54b6c2fb.diff
LOG: PR45267: Don't reject pure-specifiers with escaped newlines in their '0' token.
Added:
Modified:
clang/lib/Parse/ParseDeclCXX.cpp
clang/test/Parser/cxx-class.cpp
Removed:
################################################################################
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index 85dc4e3e706a..86a9a8208b2e 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -2670,7 +2670,7 @@ Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
auto &Zero = NextToken();
SmallString<8> Buffer;
- if (Zero.isNot(tok::numeric_constant) || Zero.getLength() != 1 ||
+ if (Zero.isNot(tok::numeric_constant) ||
PP.getSpelling(Zero, Buffer) != "0")
return false;
diff --git a/clang/test/Parser/cxx-class.cpp b/clang/test/Parser/cxx-class.cpp
index e672c45068da..e73c8740a3ef 100644
--- a/clang/test/Parser/cxx-class.cpp
+++ b/clang/test/Parser/cxx-class.cpp
@@ -37,7 +37,9 @@ class C {
virtual int vf5a(){0;}; // function definition, expected-warning {{unused}}
virtual int vf6()(0); // expected-error +{{}} expected-note +{{}}
virtual int vf7() = { 0 }; // expected-error {{does not look like a pure-specifier}}
-
+ virtual int PR45267() = \
+ 0; // ok, despite escaped newline
+
private:
int x,f(),y,g();
inline int h();
More information about the cfe-commits
mailing list