Commits

Armin Ronacher committed ec85e93

Be explicit about rvalue references.

Comments (0)

Files changed (2)

sphinx/domains/cpp.py

         )
 
 
-class RefDefExpr(WrappingDefExpr):
+class LValRefDefExpr(WrappingDefExpr):
 
     def get_id(self):
         return self.typename.get_id() + u'R'
         return u'%s&' % self.typename
 
 
+class RValRefDefExpr(WrappingDefExpr):
+
+    def get_id(self):
+        return self.typename.get_id() + u'RR'
+
+    def __unicode__(self):
+        return u'%s&&' % self.typename
+
+
 class ConstDefExpr(WrappingDefExpr):
 
     def __init__(self, typename, prefix=False):
             elif self.match(_array_def_re):
                 expr = ArrayDefExpr(expr, self.last_match.group(1))
             elif self.skip_string('&'):
-                expr = RefDefExpr(expr)
+                if self.skip_string('&'):
+                    expr = RValRefDefExpr(expr)
+                else:
+                    expr = LValRefDefExpr(expr)
             else:
                 return expr
 

tests/test_cpp_domain.py

     assert unicode(parse('type_object', 'long long int foo')) == 'long long foo'
 
 
+    x = 'MyClass::MyClass(MyClass::MyClass&&)'
+    assert unicode(parse('function', x)) == x
+
+
 def test_operators():
     x = parse('function', 'void operator new [  ] ()')
     assert unicode(x) == 'void operator new[]()'