Skip to content

V8 CRTP regression: NDK r27+ (Clang 18+) fails to compile turboshaft on v26.x #10

Description

@Towartz

Problem

NDK r27+ ships Clang 18+, which introduces a CRTP (Curiously Recurring Template Pattern) name-lookup regression in V8's turboshaft AssemblerOpInterface<Next> : public Next.

Error signature

../deps/v8/src/compiler/turboshaft/assembler.h:1549:24: error: member initializer 'matcher_' does not name a non-static data member or base class
../deps/v8/src/compiler/turboshaft/assembler.h:1551:52: error: use of undeclared identifier 'matcher_'
../deps/v8/src/compiler/turboshaft/assembler.h:1557:12: error: use of undeclared identifier 'ReduceIfReachableTypeHint'
...
fatal error: too many errors emitted, stopping now [-ferror-limit=]

Root cause

Clang 18+ requires this-> qualification for dependent names in templated base classes (CRTP). V8's AssemblerOpInterface<Next> : public Next uses unqualified names like matcher_, ReduceIfReachable*, resolve() in macros and constructor initializer lists. These worked with Clang 17 but fail with Clang 18+.

The affected code is in deps/v8/src/compiler/turboshaft/assembler.h — the DECL_MULTI_REP_BINOP_V, DECL_MULTI_REP_BINOP, and related macros, plus the constructor initializer list at line ~1549.

Current workaround

Use NDK r26d (Clang 17) — the last NDK release without this regression.

  • main branch (v26.x): pinned to r26d
  • build_ndkr27 branch (v24.x LTS): uses r27d (v24.x's V8 turboshaft is unaffected)

What needs to be done

  1. Upstream fix in V8: add this-> to all dependent names in AssemblerOpInterface. This is a V8-side change tracked at build: update android-patches/trap-handler.h.patch nodejs/node#60369.
  2. Monitor Node.js/V8 releases for a backported fix. Once available, we can upgrade NDK and remove the r26d pin.
  3. Investigate whether a targeted patch (adding this-> only where needed) is feasible and stable enough to carry until the upstream fix lands.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions