mitsuhiko  committed 59daafc

Fixed a C++ bug that caused bad references to be generated. This also
adds a note on overloads always ending up on the first version of the
method in case more than one is defined.

  • Participants
  • Parent commits 8476c23

Comments (0)

Files changed (2)

File doc/domains.rst

    Reference a C++ object.  You can give the full signature (and need to, for
    overloaded functions.)
+.. admonition:: Note on References
+   It is currently impossible to link to a specific version of an
+   overloaded method.  Currently the C++ domain is the first domain
+   that has basic support for overloaded methods and until there is more
+   data for comparison we don't want to select a bad syntax to reference a
+   specific overload.  Currently Sphinx will link to the first overloaded
+   version of the method / function.
 The Standard Domain

File sphinx/domains/

         signode['first'] = (not self.names)
-        self.env.domaindata['cpp']['objects'][name] = \
-            (self.env.docname, self.objtype)
+        # XXX: why is objtype function?  How to get to func?
+        typ = self.objtype
+        if typ == 'function':
+            typ = 'func'
+        self.env.domaindata['cpp']['objects'].setdefault(name,
+            (self.env.docname, typ, theid))
         indextext = self.get_index_text(name)
         if indextext:
     def clear_doc(self, docname):
-        for fullname, (fn, _) in['objects'].items():
+        for fullname, (fn, _, _) in['objects'].items():
             if fn == docname:
             obj =['objects'][name]
             if obj[1] != typ:
                 return None
-            return make_refnode(builder, fromdocname, obj[0], expr.get_id(),
+            return make_refnode(builder, fromdocname, obj[0], obj[2],
                                 contnode, name)
         parser = DefinitionParser(target)
         return _create_refnode(expr.prefix(parent))
     def get_objects(self):
-        for refname, (docname, type) in['objects'].iteritems():
+        for refname, (docname, type, theid) in['objects'].iteritems():
             yield (refname, refname, type, docname, refname, 1)