jasonroelofs/rbgccxml

cv_qualified_type.to_cpp bug

Closed this issue · 2 comments

Have to say that rbgccxml is an amazing package. I've been using for about a month now with no problems. Real fantastic piece of kit. There's a tiny bug in cv_qualified_type line 14. You just need to shift the 'const' to the end of the line rather than the start. This ensures that const pointers don't end up becoming pointers to consts. Discovered when I was using it with some obfuscated container types. I'd make a patch but I don't know how and its such a tiny change it's probably not worth it. Keep up the good work!

Bug:

    def to_cpp(qualified = true)
      type = XMLParsing.find_type_of(self.node, "type")
      "const #{type.to_cpp(qualified)}" # --- This should be...
    end

No Bug:

   def to_cpp(qualified = true)
      type = XMLParsing.find_type_of(self.node, "type")
      "#{type.to_cpp(qualified)} const" # --- This
    end

Glad to hear it's been working out for you! I looked into this issue and found that it's a little more than just moving the const to the end of the type. I'm missing an entire use-case of const in paramters. e.g. rbgccxml doesn't currently support the following:

method(const Type * const argName);

or, as you found out

method(Type * const argName);

My handling of CvQualifiedType needs to get smarter to be able to handle all of these cases. I'll let you know when I've got this fixed.

I've pushed a fix for this. Please give it a try and let me know if that works for you.