Skip to content

Commit 5ba7dfc

Browse files
authored
Merge pull request #3694 from masatake/c++--prototype-starting-from-scope-op
C++: accept prototypes starting from :: operator
2 parents 2149d23 + 0ee0832 commit 5ba7dfc

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--sort=no
2+
--C++-kinds=+p
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bar input.cpp /^::std::string bar();$/;" p typeref:typename:::std::string file:
2+
baz input.cpp /^::std::string baz() { return "not a prototype"; }$/;" f typeref:typename:::std::string
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Taken from #3693 submitted by @b4n
2+
#include <string>
3+
4+
::std::string bar();
5+
::std::string baz() { return "not a prototype"; }

parsers/cxx/cxx_parser.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,8 @@ void cxxParserAnalyzeOtherStatement(void)
14971497

14981498
CXXToken * t = cxxTokenChainFirst(g_cxx.pTokenChain);
14991499

1500-
if(!cxxTokenTypeIsOneOf(t,CXXTokenTypeIdentifier | CXXTokenTypeKeyword))
1500+
if(!cxxTokenTypeIsOneOf(t,CXXTokenTypeIdentifier | CXXTokenTypeKeyword
1501+
| CXXTokenTypeMultipleColons))
15011502
{
15021503
CXX_DEBUG_LEAVE_TEXT("Statement does not start with an identifier or keyword");
15031504
return;

0 commit comments

Comments
 (0)