CastXML / pygccxml

pygccxml is a specialized XML reader that reads the output from CastXML or GCCXML. It provides a simple framework to navigate C++ declarations, using Python classes.
Boost Software License 1.0
131 stars 45 forks source link

Fix patching of enums in default arguments for C++03 #54

Closed praetorian20 closed 8 years ago

praetorian20 commented 8 years ago

Given the following code

namespace ns
{
    enum color {red, green, blue};
    void test( color arg=blue );
}

CastXML produces a fully qualified name for the default argument - ::ns::color::blue.

While this default argument string is valid for C++11 and later, and indeed required if color were a scoped enumeration, the default argument is invalid for C++03 code.

Prior to C++11, enumerator names were added to the enclosing scope, so they could not be qualified using the enum-name. Hence, for C++03, the default argument needs to be patched to say ::ns::blue.

iMichka commented 8 years ago

Ok this seems good to go, just two minor changes, and I'll merge it. I added a Travis test for c++03, c++11 and c++14. You should rebase this patch on the latest develop, so we can see if everything is fine.

Thanks for working on a better support for newer c++ versions.

praetorian20 commented 8 years ago

OK, made the two changes, rebased and squashed into single commit. Should be good to merge.

praetorian20 commented 8 years ago

Hi, would you mind making a release containing this change? If you think you'll have #55 fixed in a few days, then I'm happy to wait for that to be included as well.

iMichka commented 8 years ago

Hi. I just released 1.7.5, so the fixes are out.

I have some other stuff to attend to in the moment, so I'll have a look at #55 later, probably next week.

praetorian20 commented 8 years ago

Awesome, thank you so much!