Menu

#557 function parameter classification bug

0.61
fixed
align (4)
c++
5
2013-07-13
2013-07-06
No

When a function is declared with a parameter with namespace qualified type and without a name, the type would be incorrectly classified as parameter name. This bug can be manifested with the following input files.

test.cfg

align_func_params = true

// test.cpp
void test_fun(std::size_t a,
              std::size_t /* b */);

The attached is the patch to fix the problem.

1 Attachments

Discussion

  • Huang-Ming Huang

    The C++ posted above has problem due to formatting issue. Here is the correctly formatted code.

    //test.cpp
    void test_fun(std::size_t a,
                  std::size_t /* b */);
    
     
  • Huang-Ming Huang

    My previous patch contains a bug. In addition, it couldn't handle the cases with reference and pointer types. Here is a new patch to fix the problem.

     
  • Ben Gardner

    Ben Gardner - 2013-07-13
    • labels: --> align
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -3,13 +3,11 @@
     ## test.cfg
     align_func_params = true
    
    -------------
    -
    +~~~~~
     // test.cpp
     void test_fun(std::size_t a,
    
    -             std::size_t /* b */);
    -
    -----------------------------------------
    +              std::size_t /* b */);
    +~~~~~
    
     The attached is the patch to fix the problem.
    
    • status: open --> fixed
    • assigned_to: Ben Gardner
    • Language: --> c++
    • Group: Future --> 0.61
     
  • Ben Gardner

    Ben Gardner - 2013-07-13

    Patch applied in commit 860378c4ba6aa482.

    Thanks.

     
MongoDB Logo MongoDB