bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

indent munges const cpp methods


From: Simmons, Aaron
Subject: indent munges const cpp methods
Date: Tue, 15 Dec 2009 15:45:10 -0500

Run this C++ code through indent 2.2.10 with just the defaults:



        #include <stdio.h>



        typedef struct TestThing_s

        {

          int writeToFile (char *filename, const char *encoding = NULL) const;

        } TestThing_t;





        int

        TestThing_t::writeToFile (char *filename, const char *encoding) const

        {

          return 0;

        }



And you will get:



        #include <stdio.h>



        typedef struct TestThing_s

        {

          int writeToFile (char *filename, const char *encoding = NULL) const;

        } TestThing_t;





        int

        TestThing_t::writeToFile (char *filename, const char *encoding) const 
const

        {

          return 0;

        }



Notice the "const const" on the writeToFile implementation.  As you might 
expect, this doesn't compile:

        test.cpp:10: error: duplicate cv-qualifier





btw, this happens on both Ubuntu and Mac OS X.







Thanks,

aaron



reply via email to

[Prev in Thread] Current Thread [Next in Thread]