From ddf65130c1f519be89252045ab5de60ed872ffaf Mon Sep 17 00:00:00 2001 From: zhaoxuhui Date: Mon, 24 Apr 2023 14:05:00 +0800 Subject: [PATCH] [BSC] bugfix method ambiguous --- clang/lib/Parse/ParseDecl.cpp | 1 - .../BSC/Method/Struct/struct_error_function_definition.cbs | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 clang/test/BSC/Method/Struct/struct_error_function_definition.cbs diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 41e3a4bb78f5..a51f5add7dfd 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -5671,7 +5671,6 @@ static bool isPipeDeclerator(const Declarator &D) { } bool Parser::IsBSCMethodAmbiguous() { - assert(NextToken().isNot(tok::eof)); if (GetLookAheadToken(2).isNot(tok::coloncolon)) { bool FlagUnsigned = (Tok.is(tok::kw_unsigned) && NextToken().isOneOf(tok::kw_int, tok::kw_short, diff --git a/clang/test/BSC/Method/Struct/struct_error_function_definition.cbs b/clang/test/BSC/Method/Struct/struct_error_function_definition.cbs new file mode 100644 index 000000000000..a02ac305ffaf --- /dev/null +++ b/clang/test/BSC/Method/Struct/struct_error_function_definition.cbs @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -verify %s + +struct PollResult_int {}; + +struct struct PollResult_int PollResult_int::completed(struct PollResult_int *this, int result) { // expected-error {{declaration of anonymous struct must be a definition}} +} // expected-error {{expected identifier or '('}} -- Gitee