Skip to content

Commit

Permalink
[C++] Allow template prefix on union declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
jbms committed Mar 27, 2022
1 parent 2e9f564 commit c0a0da0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sphinx/domains/cpp.py
Expand Up @@ -6983,7 +6983,7 @@ def parse_declaration(self, objectType: str, directiveType: str) -> ASTDeclarati
if self.match(_visibility_re):
visibility = self.matched_text

if objectType in ('type', 'concept', 'member', 'function', 'class'):
if objectType in ('type', 'concept', 'member', 'function', 'class', 'union'):
templatePrefix = self._parse_template_declaration_prefix(objectType)

if objectType == 'type':
Expand Down
3 changes: 3 additions & 0 deletions tests/test_domain_cpp.py
Expand Up @@ -917,6 +917,9 @@ def test_domain_cpp_ast_requires_clauses():
check('class',
'template<typename T> requires IsValid<T> {key}T : Base',
{4: 'I0EIQ7IsValidI1TEE1T'}, key='class')
check('union',
'template<typename T> requires IsValid<T> {key}T',
{4: 'I0EIQ7IsValidI1TEE1T'}, key='union')
check('member',
'template<typename T> requires IsValid<T> int Val = 7',
{4: 'I0EIQ7IsValidI1TEE3Val'})
Expand Down

0 comments on commit c0a0da0

Please sign in to comment.