#215 C++ funtion returning const pointer to const objects

open-accepted
None
5
2008-03-17
2008-03-04
g.org
No

the following valid cpp code, containing several const definitions, is not handled right:

const OpmodeTableModel::TasktySet* const OpmodeTableModel::getTaskTypes(const string& opmode) const

the output of ctags 5.7 (used by gvim on WinXP) contains wrong class information:

getTaskTypes .\m950.cpp /^const OpmodeTableModel::TasktySet* const OpmodeTableModel::getTaskTypes(const string& opmode) const$/;" f class:OpmodeTableModel::OpmodeTableModel

Discussion

  • g.org
    g.org
    2008-03-04

     
    Attachments
  • Elliott Hughes
    Elliott Hughes
    2008-03-17

    • assigned_to: nobody --> dhiebert
    • status: open --> open-accepted
     
  • Elliott Hughes
    Elliott Hughes
    2008-03-17

    Logged In: YES
    user_id=1127237
    Originator: NO

    the submitter is correct. most of the "const"s aren't relevant, though. it's the ones between the return type and the member function name:

    C::T * C::m1() {} // OK: C
    C::T * const C::m2() {} // WRONG: C::C!
    C::T const * C::m3() {} // WRONG: C::C!
    C::T const * const C::m4() {} // WRONG: C::C!

    i've committed a test case (Tests/bug1907083.cpp) but haven't been able to follow the code well enough to understand where it's going wrong.

    assigning to darren to see if he knows what code's responsible.

     
  • Elliott Hughes
    Elliott Hughes
    2008-03-17

    Logged In: YES
    user_id=1127237
    Originator: NO

    see also bug #1799340.