diff --git a/CHANGES b/CHANGES index 47a6c6aa0..6402d3315 100644 --- a/CHANGES +++ b/CHANGES @@ -68,6 +68,7 @@ Bugs fixed * C++, add missing support for 'friend' functions. * C++, add missing support for virtual base classes (thanks to Rapptz). * C++, add support for final classes. +* C++, fix parsing of types prefixed with 'enum'. Documentation ------------- diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index e268c9ed8..aa3af34bc 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -38,7 +38,9 @@ from sphinx.util.docfields import Field, GroupedField All versions are generated and attached to elements. The newest is used for the index. All of the versions should work as permalinks. - See http://www.nongnu.org/hcb/ for the grammar. + See http://www.nongnu.org/hcb/ for the grammar, + or https://github.com/cplusplus/draft/blob/master/source/grammar.tex + for the newest grammar. common grammar things: template-declaration -> @@ -2387,7 +2389,7 @@ class DefinitionParser(object): 'float', 'double', 'auto' ) - _prefix_keys = ('class', 'struct', 'union', 'typename') + _prefix_keys = ('class', 'struct', 'enum', 'union', 'typename') def __init__(self, definition, warnEnv): self.definition = definition.strip() diff --git a/tests/test_domain_cpp.py b/tests/test_domain_cpp.py index 79c6f6682..5c6a4f8e0 100644 --- a/tests/test_domain_cpp.py +++ b/tests/test_domain_cpp.py @@ -226,6 +226,13 @@ def test_type_definitions(): check('function', 'friend std::ostream &f(std::ostream&, int)', 'f__osR.i', '1fRNSt7ostreamEi') + # from breathe#223 + check('function', 'void f(struct E e)', 'f__E', '1f1E') + check('function', 'void f(class E e)', 'f__E', '1f1E') + check('function', 'void f(typename E e)', 'f__E', '1f1E') + check('function', 'void f(enum E e)', 'f__E', '1f1E') + check('function', 'void f(union E e)', 'f__E', '1f1E') + check('class', 'public A', "A", "1A", output='A') check('class', 'private A', "A", "1A")