Skip to content

Build fails on Apple clang 16: alias-template CTAD in Negentropy call sites #265

Description

@kojira

Summary

Current master fails to build with Apple clang 16 (the compiler in the Xcode Command Line Tools shipped with macOS 15):

src/apps/relay/RelayNegentropy.cpp:99:24: error: alias template 'Negentropy' requires template arguments; argument deduction only allowed for class templates

The same error appears at four call sites in src/apps/mesh/cmd_sync.cpp.

Cause

Negentropy ne(storage, ...) relies on class template argument deduction through an alias template:

template<typename T>
using Negentropy = negentropy::Negentropy<T>;   // external/negentropy/cpp/negentropy.h

CTAD for alias templates is a C++20 feature (P1814). Apple clang 16 does not implement it; Apple clang 17 does.

Why CI doesn't catch it

The macos.yml workflow runs on macos-latest, which currently carries clang 17, so the job stays green. Anyone on a stock macOS 15 install with the standard CLT hits the error.

Reproduction

Platform Compiler Result
macOS 15.2, x86_64 Apple clang 16.0.0 (clang-1600.0.26.6) ❌ error above, pristine master c65da49
macOS, arm64 Apple clang 17.0.0 (clang-1700.0.13.5) ✅ builds

Fix

Naming the template argument explicitly at the five call sites is enough:

Negentropy<std::remove_reference_t<decltype(storage)>> ne(storage, ...);

It's a no-op wherever deduction already worked, and needs no per-site knowledge of the storage type. Verified: with this change master builds and runs on the clang 16 machine, and still builds unchanged on clang 17.

I have this ready as a small PR and will open it referencing this issue.

Thanks for the recent macOS work (#190, #210) — with those in, this was the only thing left between master and a clean build on a current stock macOS install.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions