Skip to content

breaking change: Support object member pointers - #165

Open
virtuald wants to merge 5 commits into
mainfrom
fix/member-pointer-parsing
Open

breaking change: Support object member pointers#165
virtuald wants to merge 5 commits into
mainfrom
fix/member-pointer-parsing

Conversation

@virtuald

Copy link
Copy Markdown
Member

This will result in cxxheaderparser 2.x

@virtuald

Copy link
Copy Markdown
Member Author

@codex review

@virtuald
virtuald force-pushed the fix/member-pointer-parsing branch from bfaf980 to bdb9724 Compare August 23, 2026 19:39

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bfaf980cf8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cxxheaderparser/types.py Outdated
@virtuald

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c0173586b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cxxheaderparser/parser.py Outdated
@virtuald

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 104d8c1bbc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cxxheaderparser/parser.py Outdated
@virtuald

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

if itok.type == "*"
and i > 0
and inner_toks[i - 1].type == "DBL_COLON"

P2 Badge Ignore member-pointer tokens inside grouped function suffixes

When an ordinary function-pointer declarator is redundantly grouped and one of its parameters is a member pointer, this scan mistakes the parameter's C::* for the outer declarator's operator because it searches the entire balanced token list without tracking nesting. For example, void ((*p)(int C::*)); is valid C++ and the ungrouped form now parses, but this form raises CxxParseError expecting PLACEHOLDER; restrict the search to the declarator portion/top-level nesting rather than parameter suffixes.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@virtuald

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 53b5afaafb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cxxheaderparser/types.py Outdated
@virtuald

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b849c2fce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cxxheaderparser/parser.py Outdated
@virtuald
virtuald force-pushed the fix/member-pointer-parsing branch from 6b849c2 to 50c208b Compare August 24, 2026 02:07
Comment thread docs/types.rst
parser types
------------

.. versionchanged:: 2.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to have this admonition on the types themselves rather than at the top here?

@virtuald
virtuald force-pushed the fix/member-pointer-parsing branch from 50c208b to 5158cf4 Compare August 24, 2026 04:53
@virtuald

Copy link
Copy Markdown
Member Author

@codex review

Build declarations from the identifier outward so pointer, reference, array, and function precedence is preserved at every nesting level. Establish the distinction between object declarators and complete type-ids, add an explicit member-pointer node, and format varargs, noexcept, qualifiers, and trailing returns consistently.
Parse function-type cv/ref qualifiers and noexcept independently from ordinary function declarations. Reuse one function-type construction path so typedefs, pointers, and named function parameters retain the same semantics and round-trip through formatting.
Model the class-member indirection as its own declarator node instead of storing an owner on FunctionType. Parse object and function member pointers at any nesting level, preserve declarator precedence through redundant grouping, and document the parsed-model compatibility break.
Use the broader TypeId model in aliases, template arguments, and parse_typename so bare functions and complex member-pointer types behave consistently across contexts. Keep ordinary declarators constrained to object-compatible decorated types.
Apply function-parameter adjustment to both named and abstract declarators, distinguish grouped names from function postfixes in nested contexts, and validate complete trailing return types without rejecting legal wrapped function types.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5158cf4a42

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cxxheaderparser/parser.py
@virtuald
virtuald force-pushed the fix/member-pointer-parsing branch from 5158cf4 to 6b7ac8f Compare August 24, 2026 05:08
@virtuald

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b7ac8f2da

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cxxheaderparser/parser.py
Comment on lines +2584 to +2586
grouped_parameter_name_ok
and len(toks) == 1
and toks[0].type in ("NAME", "final")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recognize grouped array parameter declarators

When a parameter name and its array suffix are grouped together, as in the valid declaration void f(int (p[3]));, this single-token check fails to classify (p[3]) as a grouped declarator. The parser consequently interprets it as a function-type parameter list and returns an anonymous pointer-to-function type whose parameter is p[3], instead of the named array parameter that the parent revision produced. Accept a parameter name followed by array suffixes as a grouped declarator.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants