C++, fix parsing error of non-type template arg

Fixes sphinx-doc/sphinx#3542
This commit is contained in:
Jakob Lykke Andersen 2017-03-12 15:03:20 +09:00
parent a98414355a
commit acf5f94940
3 changed files with 12 additions and 7 deletions

View File

@ -30,6 +30,7 @@ Bugs fixed
* #3533: Moving from Sphinx 1.3.1 to 1.5.3 breaks LaTeX compilation of links * #3533: Moving from Sphinx 1.3.1 to 1.5.3 breaks LaTeX compilation of links
rendered as code rendered as code
* #2665, #2607: Link names in C++ docfields, and make it possible for other domains. * #2665, #2607: Link names in C++ docfields, and make it possible for other domains.
* #3542: C++, fix parsing error of non-type template argument with template.
Testing Testing
-------- --------

View File

@ -3124,7 +3124,7 @@ class DefinitionParser(object):
value = self.matched_text value = self.matched_text
else: else:
# TODO: add handling of more bracket-like things, and quote handling # TODO: add handling of more bracket-like things, and quote handling
brackets = {'(': ')', '[': ']'} brackets = {'(': ')', '[': ']', '<': '>'}
symbols = [] symbols = []
while not self.eof: while not self.eof:
if (len(symbols) == 0 and self.current_char in end): if (len(symbols) == 0 and self.current_char in end):

View File

@ -408,12 +408,6 @@ def test_templates():
check('class', "template<int T = 42> A", None, "I_iE1A") check('class', "template<int T = 42> A", None, "I_iE1A")
check('class', "template<int = 42> A", None, "I_iE1A") check('class', "template<int = 42> A", None, "I_iE1A")
# from breathe#218
check('function',
"template<typename F> "
"void allow(F *f, typename func<F, B, G!=1>::type tt)",
None, "I0E5allowP1FN4funcI1F1BXG!=1EE4typeE")
# from #2058 # from #2058
check('function', check('function',
"template<typename Char, typename Traits> " "template<typename Char, typename Traits> "
@ -457,6 +451,16 @@ def test_templates():
check('concept', 'template<typename ...Pack> Numerics = (... && Numeric<Pack>)', check('concept', 'template<typename ...Pack> Numerics = (... && Numeric<Pack>)',
None, 'IDpE8Numerics') None, 'IDpE8Numerics')
def test_template_args():
# from breathe#218
check('function',
"template<typename F> "
"void allow(F *f, typename func<F, B, G!=1>::type tt)",
None, "I0E5allowP1FN4funcI1F1BXG!=1EE4typeE")
# from #3542
check('type', "template<typename T> "
"enable_if_not_array_t = std::enable_if_t<!is_array<T>::value, int>",
None, "I0E21enable_if_not_array_t")
def test_attributes(): def test_attributes():
# style: C++ # style: C++