ctags icon indicating copy to clipboard operation
ctags copied to clipboard

C++: variable definition with namespace prefix taggeds as a member

Open masatake opened this issue 9 months ago • 0 comments

input.cpp:

class C {};
namespace n {  extern C c; }
C n::c;

gcc accepts this.

$ ./ctags --options=NONE --sort=no --fields=+KZ -o - input.cpp
ctags: Notice: No options will be read from files or environment
C	input.cpp	/^class C {};$/;"	class	file:
n	input.cpp	/^namespace n {  extern C c; }$/;"	namespace	file:
c	input.cpp	/^C n::c;$/;"	member	scope:class:n	typeref:typename:C

c is tagged as a member. It should be recognized as a variable.

C c0;
C m::c1;

This is a smaller input, though gcc rejects. ctags extracts c0 as a variable but c1 as a member.

masatake avatar May 23 '25 21:05 masatake