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:54f5198d-9056-6b8a-25e6-d31ec3f5cf22 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B00C:203C06:1DE1F83:288ED11:6A62FBB5 |
| html-safe-nonce | 0a0faef9e5dcfcefab6852ab1a2b5be3ded17d3fcd0bceade51f363c8b376fa9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDBDOjIwM0MwNjoxREUxRjgzOjI4OEVEMTE6NkE2MkZCQjUiLCJ2aXNpdG9yX2lkIjoiMTIwNTU3MTE4MTQ4NTA4NTk3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f14fba572fe220233dbf2f5c719706ad3ad53f966d9f0383af31d54ad5b1d1f9 |
| 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 | 59e40dc698184067b40ef2d941585f66ed42711564a879644f984f1eacea129c |
| 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 | b4f544bf80583e749557efd76afda56317b6252d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width