[C++] Allow template prefix on union declarations

This commit is contained in:
Jeremy Maitin-Shepard 2022-03-27 11:03:30 -07:00 committed by Jakob Lykke Andersen
parent 33f5474951
commit 3bd80e7c54
2 changed files with 4 additions and 1 deletions

View File

@ -6997,7 +6997,7 @@ class DefinitionParser(BaseParser):
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':

View File

@ -912,6 +912,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'})