diff --git a/cxxheaderparser/types.py b/cxxheaderparser/types.py index 5cd2ffe..e078a4a 100644 --- a/cxxheaderparser/types.py +++ b/cxxheaderparser/types.py @@ -374,9 +374,9 @@ class PointerToMember: v = " volatile" if self.volatile else "" ptr_to = self.ptr_to if isinstance(ptr_to, (Array, FunctionType)): - return ptr_to.format_decl(f"({base_type.format()}::*{c}{v})") + return ptr_to.format_decl(f"({self.base_type.format()}::*{c}{v})") else: - return f"{ptr_to.format()} {base_type.format()}::*{c}{v}" + return f"{ptr_to.format()} {self.base_type.format()}::*{c}{v}" def format_decl(self, name: str): """Format as a named declaration""" @@ -384,9 +384,9 @@ class PointerToMember: v = " volatile" if self.volatile else "" ptr_to = self.ptr_to if isinstance(ptr_to, (Array, FunctionType)): - return ptr_to.format_decl(f"({base_type.format()}::*{c}{v} {name})") + return ptr_to.format_decl(f"({self.base_type.format()}::*{c}{v} {name})") else: - return f"{ptr_to.format()} {base_type.format()}::*{c}{v} {name}" + return f"{ptr_to.format()} {self.base_type.format()}::*{c}{v} {name}"