Title: expandHashHash(): function-like macro not expanded when '(' is not adjacent (PAR-style indirection) · Issue #656 · cppcheck-opensource/simplecpp · GitHub
Open Graph Title: expandHashHash(): function-like macro not expanded when '(' is not adjacent (PAR-style indirection) · Issue #656 · cppcheck-opensource/simplecpp
X Title: expandHashHash(): function-like macro not expanded when '(' is not adjacent (PAR-style indirection) · Issue #656 · cppcheck-opensource/simplecpp
Description: When ## concatenation produces a function-like macro name but the argument list (...) is not immediately adjacent in the replacement text (hidden behind a secondary macro parameter), simplecpp aborts expansion and emits the concatenated ...
Open Graph Description: When ## concatenation produces a function-like macro name but the argument list (...) is not immediately adjacent in the replacement text (hidden behind a secondary macro parameter), simplecpp abor...
X Description: When ## concatenation produces a function-like macro name but the argument list (...) is not immediately adjacent in the replacement text (hidden behind a secondary macro parameter), simplecpp abor...
Opengraph URL: https://github.com/cppcheck-opensource/simplecpp/issues/656
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"expandHashHash(): function-like macro not expanded when '(' is not adjacent (PAR-style indirection)","articleBody":"When `##` concatenation produces a function-like macro name but the argument list `(...)` is not immediately adjacent in the replacement text (hidden behind a secondary macro parameter), simplecpp aborts expansion and emits the concatenated token bare.\n\n## Reproducer\n\n```cpp\n#define PAR(a, ...) a __VA_ARGS__\n#define PREFIX_SCALAR(T, N) T N\n#define DISPATCH(kind, ...) PAR(PREFIX_ ## kind, (__VA_ARGS__))\nDISPATCH(SCALAR, int, x)\n```\n\nExpected: \n```\nint x\n```\nActual:\n```\n1:\n2:\n3:\n4: PREFIX_SCALAR ( int , x )\n```\n\n## Root cause\n\n`expandHashHash()` checks only `B-\u003enext-\u003eop == '('` immediately after the `##` result. In the PAR pattern, `B-\u003enext` is `,` (not `(`), so the function-like expansion is skipped.\n\n## Fix\n\nA forward-scan fallback in the `appendTokens` context (`expandResult==false`) walks ahead on the same line, skipping `,` separators and resolving named parameter tokens via `expandArg()`, until `(` is found.\n\nPR attached: https://github.com/cppcheck-opensource/simplecpp/pull/655","author":{"url":"https://github.com/paulafy6","@type":"Person","name":"paulafy6"},"datePublished":"2026-05-28T08:27:43.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/656/simplecpp/issues/656"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:74d2878f-b5c8-5b91-a252-3b16aa322c4b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E542:391A54:F53C7:14BCD6:6A4D9447 |
| html-safe-nonce | 6491c7cae8c62b481a80ceda7ce838b4091bef24880234986a8229c6e3d5a41c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNTQyOjM5MUE1NDpGNTNDNzoxNEJDRDY6NkE0RDk0NDciLCJ2aXNpdG9yX2lkIjoiMjI4Mjc2NDQxNjU0ODk2NzQ5NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 86aae74aab36f0a62f3591c4c6f726ab7b09dab36f4b0bf97dc42a274bd48287 |
| hovercard-subject-tag | issue:4538913513 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/cppcheck-opensource/simplecpp/656/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ef41617993c19d42c6b419330a73b21c2440958a3720bf215cd7b381b27724bf/cppcheck-opensource/simplecpp/issues/656 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ef41617993c19d42c6b419330a73b21c2440958a3720bf215cd7b381b27724bf/cppcheck-opensource/simplecpp/issues/656 |
| og:image:alt | When ## concatenation produces a function-like macro name but the argument list (...) is not immediately adjacent in the replacement text (hidden behind a secondary macro parameter), simplecpp abor... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | paulafy6 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/cppcheck-opensource/simplecpp git https://github.com/cppcheck-opensource/simplecpp.git |
| octolytics-dimension-user_id | 278097703 |
| octolytics-dimension-user_login | cppcheck-opensource |
| octolytics-dimension-repository_id | 33434464 |
| octolytics-dimension-repository_nwo | cppcheck-opensource/simplecpp |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 33434464 |
| octolytics-dimension-repository_network_root_nwo | cppcheck-opensource/simplecpp |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 74e2a9c78f1e38588de4f25885878349d721eedf |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width