diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index eb3524375ed..d53b9431d3a 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -2111,9 +2111,10 @@ def describe_signature(self, signode, mode, env, symbol): class ASTConcept(ASTBase): - def __init__(self, nestedName, isFunction): + def __init__(self, nestedName, isFunction, initializer): self.nestedName = nestedName self.isFunction = isFunction # otherwise it's a variable concept + self.initializer = initializer @property def name(self): @@ -2129,6 +2130,8 @@ def __unicode__(self): res = text_type(self.nestedName) if self.isFunction: res += "()" + if self.initializer: + res += text_type(self.initializer) return res def describe_signature(self, signode, mode, env, symbol): @@ -2136,6 +2139,8 @@ def describe_signature(self, signode, mode, env, symbol): self.nestedName.describe_signature(signode, mode, env, symbol) if self.isFunction: signode += nodes.Text("()") + if self.initializer: + self.initializer.describe_signature(signode, mode) class ASTBaseClass(ASTBase): @@ -3552,7 +3557,12 @@ def _parse_concept(self): self.skip_ws() if not self.skip_string(')'): self.fail("Expected ')' in function concept declaration.") - return ASTConcept(nestedName, isFunction) + + initializer = self._parse_initializer('member') + if initializer and isFunction: + self.fail("Function concept with initializer.") + + return ASTConcept(nestedName, isFunction, initializer) def _parse_class(self): name = self._parse_nested_name()