-
Notifications
You must be signed in to change notification settings - Fork 722
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Expected bool, found integral variable (0.30 -> 0.31 Regression) #1145
Comments
Thanks for the bug report! |
Self-reminder to take a look at this one |
Arrgh, this includes windows.h, and I'm on a Linux system. @zacps, any chance to call |
Here. |
Thanks! Here's a reduced test-case out of that (probably can be reduced even further): template <typename _Ty>
struct __vcrt_va_list_is_reference
{
enum : bool { __the_value = false };
};
template <typename _Ty>
struct __vcrt_va_list_is_reference<_Ty&>
{
enum : bool { __the_value = true };
};
template <typename _Ty>
struct __vcrt_va_list_is_reference<_Ty&&>
{
enum : bool { __the_value = true };
};
template <typename _Ty>
void __vcrt_va_start_verify_argument_type() throw()
{
static_assert(!__vcrt_va_list_is_reference<_Ty>::__the_value, "va_start argument must not have reference type and must not be parenthesized");
} You should be able to work around this blacklisting the relevant bits, but still this is a bug of course. |
This is probably due to us not handling |
Aand indeed, more reduced test-case: enum MyEnum : bool {
Value = true,
}; |
And now the regression range makes sense, because it contains 89915f9. |
Before that we'd generate instead: #[repr(u8)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum MyEnum {
Value = 1,
} |
Just use the repr name we generate, since we generate constants for that. It's not worth trying to guess the actual type to use IMO. Bindings lose a bit of portability I guess, but that's really a lost bet already, so instead of special-casing bool and map constants, let's use a consistent representation everywhere. Fixes rust-lang#1145
Submitted a fix in #1232. |
Amazing, thanks! |
codegen: Try to reasonably handle enum : bool. Just use the repr name we generate, since we generate constants for that. It's not worth trying to guess the actual type to use IMO. Bindings lose a bit of portability I guess, but that's really a lost bet already, so instead of special-casing bool and map constants, let's use a consistent representation everywhere. Fixes #1145
Regression between the 0.30 and 0.31 releases that causes an invalid type (int instead of bool) in generated bindings.
Platform: MSVC x86_64
Input C/C++ Header
winpty.h
I unfortunately wasn't able to get creduce working on windows so unreduced is the best I can do for now.
Bindgen Invocation
Actual Results
Expected Results
Compilation succeeds
The text was updated successfully, but these errors were encountered: