Skip to content

Commit

Permalink
Merge pull request #3694 from masatake/c++--prototype-starting-from-s…
Browse files Browse the repository at this point in the history
…cope-op

C++: accept prototypes starting from :: operator
  • Loading branch information
masatake committed Apr 15, 2023
2 parents 2149d23 + 0ee0832 commit 5ba7dfc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--sort=no
--C++-kinds=+p
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bar input.cpp /^::std::string bar();$/;" p typeref:typename:::std::string file:
baz input.cpp /^::std::string baz() { return "not a prototype"; }$/;" f typeref:typename:::std::string
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Taken from #3693 submitted by @b4n
#include <string>

::std::string bar();
::std::string baz() { return "not a prototype"; }
3 changes: 2 additions & 1 deletion parsers/cxx/cxx_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,8 @@ void cxxParserAnalyzeOtherStatement(void)

CXXToken * t = cxxTokenChainFirst(g_cxx.pTokenChain);

if(!cxxTokenTypeIsOneOf(t,CXXTokenTypeIdentifier | CXXTokenTypeKeyword))
if(!cxxTokenTypeIsOneOf(t,CXXTokenTypeIdentifier | CXXTokenTypeKeyword
| CXXTokenTypeMultipleColons))
{
CXX_DEBUG_LEAVE_TEXT("Statement does not start with an identifier or keyword");
return;
Expand Down

0 comments on commit 5ba7dfc

Please sign in to comment.