Skip to content

error: missing template arguments after 'make_index_sequence<...auto...>' in gen0.cxx #1501

@barries

Description

@barries

Describe the bug
Generating an FFI for a minimal header:

#pragma once

#include<array>

struct VersionRange {
};

...generates this error:

warning: [email protected]: /home/barrie/my/ui/../../tmp/ui/debug/build/my-ui-1b2780bae091e965/out/autocxx-build-dir/cxx/gen0.cxx:162:31: error: missing template arguments after 'make_index_sequence<...auto...>'
warning: [email protected]:   162 |   using make_index_sequence = ::std::make_index_sequence;
warning: [email protected]:       |                               ^~
warning: [email protected]: In file included from /usr/include/c++/11/array:38,
warning: [email protected]:                  from /home/barrie/my/ad/src/cg/adp_spec_defs.h:6,
warning: [email protected]:                  from /home/barrie/my/ui/../../tmp/ui/debug/build/my-ui-1b2780bae091e965/out/autocxx-build-dir/cxx/gen0.cxx:1:
warning: [email protected]: /usr/include/c++/11/utility:343:11: note: 'template<long unsigned int _Num> using make_index_sequence = std::make_integer_sequence<long unsigned int, _Num>' declared here
warning: [email protected]:   343 |     using make_index_sequence = make_integer_sequence<size_t, _Num>;
warning: [email protected]:       |           ^~~~~~~~~~~~~~~~~~~
error: failed to run custom build command for `my-ui v0.0.0 (/home/barrie/my/ui)`

Both g++ v11 and clang v14 compile that same header without errors.

To Reproduce

In build.rs:

    // Spec the include path here because bindgen's compiler instance
    // can't seem to find it based on a relative path from the source
    // directory. Maybe due to out-of-tree builds?
    let include_path = std::fs::canonicalize("../ad/src/cg").into_diagnostic()?;
    let bindings_path = "src/aa/adp/fw_integration_tests.rs";

    // This assumes all your C++ bindings are in main.rs
    let mut b = autocxx_build::Builder::new(
        bindings_path,
        [&include_path],
    )
        .build()?;

    b.compile("adp_cpp");

In src/aa/adp/fw_integration_tests.rs:

use autocxx::prelude::*;

include_cpp! {
    #include "adp_spec_defs.h" // include path set in build.rs
    safety!(unsafe_ffi)
    generate_all!()
}

fn test_adp() {
    let got = ffi::VersionRange::new();
}

Expected behavior

No warnings.

Additional context

rustc --version:

rustc 1.90.0 (1159e78c4 2025-09-14)

rustup show:

Default host: x86_64-unknown-linux-gnu
rustup home:  /home/barrie/.rustup

installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu (active, default)
1.76.0-x86_64-unknown-linux-gnu

active toolchain
----------------
name: stable-x86_64-unknown-linux-gnu
active because: it's the default toolchain
installed targets:
  x86_64-unknown-linux-gnu

From Cargo.lock:

name = "autocxx"
version = "0.30.0"

name = "autocxx"
version = "0.30.0"

name = "cxx-gen"
version = "0.7.187"

name = "autocxx-bindgen"
version = "0.73.0"

name = "bindgen"
version = "0.70.1"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions