mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
[C++] Allow trailing requires-clause on constructors
This commit is contained in:
parent
9694aa5a26
commit
33f5474951
@ -6537,7 +6537,14 @@ class DefinitionParser(BaseParser):
|
||||
declSpecs = self._parse_decl_specs(outer=outer, typed=False)
|
||||
decl = self._parse_declarator(named=True, paramMode=outer,
|
||||
typed=False)
|
||||
self.assert_end(allowSemicolon=True)
|
||||
must_end = True
|
||||
if outer == 'function':
|
||||
# Allow trailing requires on constructors
|
||||
self.skip_ws()
|
||||
if re.compile(r'requires\b').match(self.definition, self.pos):
|
||||
must_end = False
|
||||
if must_end:
|
||||
self.assert_end(allowSemicolon=True)
|
||||
except DefinitionError as exUntyped:
|
||||
if outer == 'type':
|
||||
desc = "If just a name"
|
||||
|
@ -893,6 +893,8 @@ def test_domain_cpp_ast_requires_clauses():
|
||||
{4: 'I0EIQoo1Aoo1B1CE1fvv'})
|
||||
check('function', 'void f() requires A || B || C',
|
||||
{4: 'IQoo1Aoo1B1CE1fv'})
|
||||
check('function', 'Foo() requires A || B || C',
|
||||
{4: 'IQoo1Aoo1B1CE3Foov'})
|
||||
check('function', 'template<typename T> requires A && B || C and D void f()',
|
||||
{4: 'I0EIQooaa1A1Baa1C1DE1fvv'})
|
||||
check('function',
|
||||
|
Loading…
Reference in New Issue
Block a user