Doubling keywords

Trevor Blackwell <[email protected]>
Newsgroups gmane.comp.gnu.indent.bugs
Message-ID <1157138671.44810.11.camel@lab>
I _know_ that indent isn't supported for C++, but the following bug in
formating C++ code seems like it might represent a more general latent
bug:

$ echo 'int foo::test() const { return 7; }' | gindent

int
foo::test() const const
{
        return 7;
}

Note that the 'const' token gets output twice. It only does it with
'const' and not with other tokens:

$ echo 'int foo::test() _const { return 7; }' | gindent
int
foo::test()
    _const
{
        return 7;
}

$ echo 'int foo::test() volatile { return 7; }' | gindent
int
foo::test()
        volatile {
                return 7;
        }

I can't get it to happen without any C++isms

$ echo 'int foo_test() const { return 7; }' | gindent
int
foo_test()
        const {
                return 7;
        }

but it seems like it shouldn't duplicate tokens under any circumstances.

If there's a line break in the right place it will concatenate the
tokens:

$ (echo 'int foo::test()' ; echo 'const { return 7; }' ) | gindent
int
foo::test()
     constconst
{
        return 7;
}

Version info:

$ gindent --version
GNU indent 2.2.9

-- 
Trevor Blackwell              650 776 7870           [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.