jbcoe / jbcoe/cc-protocol

Allocation operators on an interface are silently dropped

Open
#403 0 comments 0 reactions 0 assignees View on GitHub
Important
Dominant language
C++
Stars
11
Forks
4
Avg merge
16h 39m
Merged PRs (30d)
131

Description

`operator new`, `operator delete` and their array forms are implicitly static, so `protocol_interface_function_infos` drops them at `if (is_static_member(member)) continue;` with no diagnostic:

```cpp
struct I { int f() const; void* operator new(std::size_t); void operator delete(void*) noexcept; };
// conforms against any C with int f() const; the allocation functions vanish
```

Meanwhile #388 adds `NamesAllocationOperatorsWithNoQualifiersAsTheyAreStatic` to name_mangling_tests.cc and `nw`/`dl`/`na`/`da` cases to `base_name_of`, none of which is reachable through the library. `operator co_await`, by contrast, gets a clear "is not supported in a protocol interface" throw.

CONTRIBUTING.md's "Static member functions declared on the interface itself are ignored" arguably covers this. If it is intended, the docs should name the allocation operators explicitly and the mangling cases can go; if not, they should be rejected like `co_await`.

Contributor guide

Open the contributing guide

Research direction

Start with protocol_interface_function_infos and the is_static_member(member) check, then compare the existing operator co_await handling. Review CONTRIBUTING.md, name_mangling_tests.cc, and the base_name_of cases from #388. Done means deciding whether allocation operators are intentionally ignored and documenting them explicitly, or rejecting them with a diagnostic and aligning the mangling tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.