diff --git a/cpp/ast.py b/cpp/ast.py index b7f57df..430bb6f 100644 --- a/cpp/ast.py +++ b/cpp/ast.py @@ -1076,6 +1076,10 @@ def _get_method(self, return_type_and_name, modifiers, templated_types, self._add_back_token(token) token = tokenize.Token(tokenize.SYNTAX, ';', 0, 0) + # Handle ref-qualifiers. + if token.name == '&' or token.name == '&&': + token = self._get_next_token() + if token.name == '}': self._add_back_token(token) token = tokenize.Token(tokenize.SYNTAX, ';', 0, 0) diff --git a/test/foo.h b/test/foo.h index 9c85a59..0c7ed5f 100644 --- a/test/foo.h +++ b/test/foo.h @@ -274,3 +274,8 @@ map ReturnFlags(); vector string_list; class Foo::Bar { Bar() { XXX(1) << "should work"; } }; + +class Optional { + void getValue() & { } + void getValue() && { } +};