clang and __float128 bug/error

痞子三分冷 提交于 2019-12-03 10:35:32

You can fix it with:

CXXFLAGS+="-D__STRICT_ANSI__"

I don't think clang supports __float128. It may be the same type as long double (which is 16 bytes in clang) so it may be a simple case of inserting:

#define __float128 long double

or:

typedef long double __float128;

somewhere early in your include chain.

I'm not guaranteeing that will work but it may, and it's probably best to try it out rather than wait until clang starts supporting more gcc extensions.

Either that, or switch to gcc, if that's an option. I'm pretty certain that gcc supports all of the gcc extensions :-)

See http://llvm.org/bugs/show_bug.cgi?id=13530#c3 for possible workarounds.

The solution is to have this declaration. It works like a charm:

#ifdef __clang__
typedef struct { long double x, y; } __float128;
#endif

Solutions with #define don't work because of the template specification redeclaration error.

Of course this is a hack, and you must be safe. I want clang just for a few experiments, so it won't cause any troubles.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!