Skip to content

Commit b11e39a

Browse files
authored
Merge pull request #4367 from masatake/cxx--fix-wrong-root-scope-representation
C++: (bugfix) use the root scope representation of a lambda in enum {}
2 parents dd34fe7 + 295d96c commit b11e39a

5 files changed

Lines changed: 21 additions & 1 deletion

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--sort=no
2+
--extras=+q
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
e input.cpp /^enum e {$/;" g file:
2+
__anon92a0b9a90102 input.cpp /^ x = [] {$/;" f enum:e file:
3+
T3 input.cpp /^ using T3 = int;$/;" t function:e::__anon92a0b9a90102 typeref:typename:int file:
4+
x input.cpp /^ x = [] {$/;" e enum:e file:
5+
main input.cpp /^int main(void)$/;" f typeref:typename:int
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
enum e {
2+
x = [] {
3+
using T3 = int;
4+
return 1;
5+
}()
6+
};
7+
8+
9+
int main(void)
10+
{
11+
return e::x;
12+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cxx20+module

parsers/cxx/cxx_tag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ int cxxTagCommit(int *piCorkQueueIndexFQ)
803803
// If the scope kind is enumeration then we need to remove the
804804
// last scope part. This is what old ctags did.
805805
if(cxxScopeGetSize() < 2)
806-
return -1; // toplevel enum
806+
return CORK_NIL; // toplevel enum
807807

808808
x = cxxScopeGetFullNameExceptLastComponentAsString();
809809
CXX_DEBUG_ASSERT(x,"Scope with size >= 2 should have returned a value here");

0 commit comments

Comments
 (0)