-
Notifications
You must be signed in to change notification settings - Fork 742
Missing template argument for inner type typedef. #422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@emilio this seems related to the type aliases -> use statements change. I don't think that trick is valid if we have template arguments. |
huh? Indeed we check for that. I was pretty sure this check should've caught it, I'll take a look |
So we do check that, and that check works. the thing is that the applicable_template_args check probably avoids specialized args. |
i.e., this was a pre-existing bug |
This is annoying. So when scanning the When asking about template parameters, of course, clangs tells us that we have none, so we end up not seeing the int at all. Ouch. I can't keep investigating today (3AM here and I need to wake up in exactly 4 hours :/), but that's pretty much it, we're going to need to find that type, somehow. |
After #544, there is still a bug here, but we need to modify the test case so that template <typename T>
class Foo {
public:
class InnerType {
T t;
};
};
typedef Foo<int>::InnerType Bar;
Bar func(); Generates this code: /* automatically generated by rust-bindgen */
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Foo_InnerType<T> {
pub t: T,
}
pub type Bar = InnerType;
extern "C" {
#[link_name = "_Z4funcv"]
pub fn func() -> Bar;
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct InnerType {
pub _address: u8,
}
impl Clone for InnerType {
fn clone(&self) -> Self { *self }
} Not sure what is going on with that top level |
@fitzgen's example code now generates the following and compiles fine. Should we consider this as fixed? #[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Foo {
pub _address: u8,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Foo_InnerType<T> {
pub t: T,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
}
pub type Bar = InnerType;
extern "C" {
#[link_name = "\u{1}_Z4funcv"]
pub fn func() -> Bar;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct InnerType {
pub _address: u8,
} |
Yes, we should add a test-case to the test-suite if we don't have one though. |
GitHub issue 422 was fixed but needs a test. rust-lang#422 Signed-off-by: Amanjeev Sethi <[email protected]>
GitHub issue 422 was fixed but needs a test. #422 Signed-off-by: Amanjeev Sethi <[email protected]>
GitHub issue 422 was fixed but needs a test. rust-lang#422 Signed-off-by: Amanjeev Sethi <[email protected]>
Header:
Generated:
Compile error
I think it should have generated
The text was updated successfully, but these errors were encountered: