mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
fix Issue 23584 - ImportC: __builtin_bit_cast not supported (#14795)
This commit is contained in:
parent
3368127d1a
commit
ee1acbb62d
2 changed files with 16 additions and 0 deletions
|
@ -13,3 +13,17 @@ struct Foo {
|
|||
|
||||
int y = ((size_t)((char *)&((struct Foo *)1)->x - (char *)1));
|
||||
_Static_assert(((size_t)((char *)&((struct Foo *)0)->y - (char *)0))==4, "");
|
||||
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23584
|
||||
|
||||
int foo(float bar)
|
||||
{
|
||||
return __builtin_bit_cast(unsigned int, bar);
|
||||
}
|
||||
|
||||
void test23584()
|
||||
{
|
||||
int i = foo(3.5);
|
||||
_Static_assert(foo(3.5) == 0x40600000, "1");
|
||||
}
|
||||
|
|
|
@ -71,6 +71,8 @@
|
|||
*/
|
||||
#define __builtin_offsetof(t,i) ((typeof(sizeof(0)))((char *)&((t *)0)->i - (char *)0))
|
||||
|
||||
#define __builtin_bit_cast(t,e) (*(t*)(void*)&(e))
|
||||
|
||||
/***************************
|
||||
* C11 6.10.8.3 Conditional feature macros
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue