Menu

#127 Code completion fails with complex declarations/definitions

Next_Release
open
ollydbg
Bug_Report
2019-02-16
2015-01-05
No

I have noticed that code completion system is relatively simple. It subtitutes only functions/variables with simple declarations, but complex ones like

void (*SimplePaintFunc(uint8_t r, uint8_t g, uint8_t b, uint8_t a))(int, int);

don't appear in the list (like this one) or have incorrect type.

I'm on Windows x64. Version is 13.12 (from windows installer).

Discussion

  • Teodor Petrov

    Teodor Petrov - 2015-01-05

    Can you make a full example file that can be used to demonstrate the problem?

     
  • HolyBlackCat

    HolyBlackCat - 2015-01-06

    Looks like I can't edit my post. Here it is:
    (I forgot how to reproduce the wrong type problem. Maybe it's already fixed.)

    ~~~~~~~~
    int test01; // OK
    int test02; // OK
    int (
    test03); // NOT IN THE LIST
    int (test04)(); // NOT IN THE LIST
    int test05(); // OK
    int (test06)(); // NOT IN THE LIST
    int (test07); // NOT IN THE LIST
    int
    const test08 = 0; // OK
    int (const test09) = 0; // NOT IN THE LIST
    int test10[1] = {0}; // OK
    int
    test11[1] = {0}; // OK
    int (test12)[1]; // NOT IN THE LIST
    int
    test13(); // OK
    int (test14()); // NOT IN THE LIST
    int (
    test15())(); // NOT IN THE LIST

    int main()
    {
    // Type test on the next line and look at the autocompletion list

    return 0;
    

    }
    ~~~~~~~

     

    Last edit: HolyBlackCat 2015-01-06
  • Teodor Petrov

    Teodor Petrov - 2015-01-07
    • assigned_to: ollydbg
     
  • Teodor Petrov

    Teodor Petrov - 2015-01-07

    Interesting things should be supported by c/c++ compilers...

    @ollydbg: I'm assigning this to you, because you're our cc master:) If you don't intend to fix it don't hesitate to set the owner to none.

     
  • Morten MacFly

    Morten MacFly - 2015-02-07
    • Type: --> Undefined
     
  • Alpha

    Alpha - 2015-02-08
    • Type: Undefined --> Bug_Report
     
  • jidey

    jidey - 2015-06-10

    Hi,

    I don't know if this is the same bug or not, but I have a similar problem. Code completion doesn't work with functions which have a complex (non native) type :

    enum e_example
    {
        E_EX_1,
        E_EX_2,
        E_EX_3
    };
    
    enum e_example my_function();
    
    enum e_example my_function()
    {
        return E_EX_3;
    }
    
    int main(int argc, char *argv[])
    {
        // type `my_fun` on the next line and look at the autocompletion list
    
        return 0;
    }
    

    I have the following build (13.12) on linux (centos) : Dec 25 2013, 23:43:10 - wx2.8.12 (Linux, unicode) - 32 bit.

    Sorry if this is not the same bug, please inform me, I will open another ticket.

    Thanks!

     
    • ollydbg

      ollydbg - 2015-06-12

      Hi, jidey, I just tested with the trunk code, and it failed. I have added a test case to our cctest project (r10332). Thanks for the report.

       
      • ollydbg

        ollydbg - 2019-02-16

        Hi, jidey. Your reported issue is fixed in r11572. Sorry for the long delay. And thanks for the report.

         
  • ollydbg

    ollydbg - 2015-06-12

    I add the test case https://sourceforge.net/p/codeblocks/tickets/127/#520e to our trunk, thanks HolyBlackCat for the report, here is the test result:

    ********************************************************
      Testing in file: F:\cb_sf_git\trunk\src\plugins\codecompletion\testing\cc_complex_declaration.cpp
    ********************************************************
    *FAIL: test15  test15
    *FAIL: test14  test14
    -PASS: test13  test13
    *FAIL: test12  test12
    -PASS: test11  test11
    -PASS: test10  test10
    *FAIL: test09  test09
    -PASS: test08  test08
    *FAIL: test07  test07
    *FAIL: test06  test06
    -PASS: test05  test05
    -PASS: test04  test04
    *FAIL: test03  test03
    -PASS: test02  test02
    -PASS: test01  test01
    
     

    Last edit: ollydbg 2015-06-12

Log in to post a comment.