← TrendWatcher
Hacker News
4/10

EraserAudit

A C++ static analyzer and unit-test generator that catches the 'type-erasure nesting' anti-pattern — where std::function, std::copyable_function, and std::move_only_function silently accumulate indirection layers and leak memory across round-trips.

Target user

C++ library authors and standards-aware teams building or maintaining type-erased callable wrappers

Features
  • Static rule that flags assignments between compatible type-erased wrappers (function ↔ copyable_function ↔ move_only_function) at conversion sites
  • Auto-generated fuzz tests verifying wrapper round-trips do not grow indirection depth over many iterations
  • Refactor hints recommending Arthur O'Dwyer's 'write your own 100-line type-erased callable' pattern when nesting is detected
  • CI gate that fails builds on new wrapper-nesting patterns, with severity tuned per code owner
Why now

libstdc++ shipped C++26 copyable_function with the linked-list interop bug; brownfield teams porting from std::function are about to hit the exact bug benchmarked in the article.

Signals · overall 4/10
Demand
4/10

Real concern confirmed (libstdc++ PR119125 patch exists, Sandor Dargo blog, StackOverflow Q on copyable_function vs function), but the cited HN post has only 5 points and 0 comments — narrow C++ audience with limited buzz.[PATCH v2 2/3] libstdc++: Implement C++26 copyable_function [PR119125]Interconverting std::function and copyable_function

Whitespace
4/10

Clang-tidy is free, extensible via AST matchers, and shipped with major toolchains — a type-erasure nesting check could be added as a clang-tidy plugin, eroding defensible whitespace.Clang-Tidy — Extra Clang Tools 24.0.0git documentation

Monetization
3/10

No evidence of buyers for this hyper-niche check; commercial C++ static analysis (PVS-Studio, Coverity) is dominated by incumbents bundling hundreds of rules, making standalone monetization hard.Static Analysis Tools | cpp-best-practices

Longevity
7/10

C++26 just shipped copyable_function; brownfield teams porting std::function code will encounter nesting/indirection issues for many years, and type-erasure patterns are core to modern C++ libraries.C++26: More function wrappers | Sandor Dargo's Blog

Feasibility
3/10

Building a full C++ static analyzer + unit-test generator from scratch is substantial work; the check itself is tractable via a Clang AST plugin, but productizing and maintaining across compiler versions is non-trivial.

Interconverting std::function with copyable_function · 5 points · 0 commentsHacker News · 2026-07-30 (today)