#14 support for C++'s "using" keyword


I'd like to have support for C++'s using keyword. Take
the following

#include <iostream>
using namespace std;

struct A
void f() {cout<<"A"<<endl;};

struct B
void f() {cout<<"B"<<endl;};

struct C: public A,public B
using B::f;

int main()
C c;


I'd like ctags to be able to generate the following 2
lines (either of
them or both depending on command line flags):

1. a line for the symbol C::f, which is (except for the
symbol name)
identical to that for B::f

2. a line for the using directive like this:
C::f temp.cpp <pattern> kind:using line:16
language:C++ class:C access:public

I understand that C++ inheritance is too complicated
for ctags to
understand, so that generating appropriate tags for
inherited symbols is too difficult to implement.
However, inherited symbols explicitly mentioned in the
scope of the derived class with a using directive
should not be difficult to extract.


  • Darren Hiebert
    Darren Hiebert

    • assigned_to: nobody --> dhiebert
    • summary: support for C++'s "using" keyword --> support for C++'s "using" keyword
  • Darren Hiebert
    Darren Hiebert

    Logged In: YES

    One problem that I see with trying to add this is that it is
    not possible for ctags to know what kind of tag B::f is.
    Ctags will not know whether it is a function or a member
    variable, etc., and could not properly mark its kind in the
    tag file.


  • Logged In: YES

    Hmm. Probably impossible without making ctags understand
    inheritance and work globally rather than 1 file at a time.
    But emitting a line for the using line with type:using (see
    2. in my initial suggestion) would still be useful as this
    would give programs postprocessing ctags output at least the
    information that the using line is there. Which symbol it
    refers to can then be determined by looking at the complete
    ctags information.