Skip to content
This repository was archived by the owner on Aug 5, 2026. It is now read-only.

Penalise void* arguments in overload priority as intended - #225

Open
conrade-ctc wants to merge 1 commit into
compiler-research:masterfrom
chicagotrading:conrade/voidp-overload-priority
Open

conrade-ctc wants to merge 1 commit into
compiler-research:masterfrom
chicagotrading:conrade/voidp-overload-priority

Conversation

@conrade-ctc

@conrade-ctc conrade-ctc commented Jul 31, 2026 •

Copy link
Copy Markdown

CPPMethod::GetPriority's void* penalty never applied, for two independent reasons: it sits behind Cppyy::IsBuiltin(aname) and no pointer spelling is builtin (IsBuiltin is an exact lookup over a set containing "void"), and it tested for "void*" while argument types are spelled "const void *".

So a class with both a converting constructor and a const void* one resolved by declaration order, and a handle passed where its const counterpart was expected arrived as the proxy's address:

struct Handle      { void* data;       Handle(void* p); };
struct ConstHandle { const void* data; ConstHandle(const void* p);   // wins
                                       ConstHandle(Handle h); };

Match on the whitespace-compacted name, ahead of the builtin branch.

Regression test: compiler-research/cppyy#239
Context: compiler-research/CppInterOp#1078

The penalty was unreachable: it sat behind an IsBuiltin() check, and no pointer
spelling is reported as builtin, and it matched "void*" while argument types are
spelled "const void *". So a class with both a converting constructor and a
const void* one resolved by declaration order, and a handle passed where the
const handle was expected arrived as the proxy's address.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant