Skip to content

Array members converted to pointers when using alias template #1057

Open
@m-ou-se

Description

@m-ou-se

Input C/C++ Header

template<int N>
using vec = double[N];

struct Thing {
	vec<3> position;
	vec<4> orientation;
	double diameter;
};

Bindgen Invocation

$ bindgen --no-layout-tests test.hpp

Actual Results

pub type vec = *mut f64;
#[repr(C)]
#[derive(Debug, Copy)]
pub struct Thing {
    pub position: vec,
    pub orientation: vec,
    pub diameter: f64,
}
impl Clone for Thing {
    fn clone(&self) -> Self { *self }
}

Expected Results

pub struct Thing {
    pub position: [f64; 3],
    pub orientation: [f64; 4],
    pub diameter: f64,
}

position and orientation are arrays of doubles. In the generated code, they are pointers.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions