clang error with 15.5 header files: cannot mangle this built-in __float128 type yet |
||
Issue descriptionWith a wide range of gn args settings and the VC toolchain package from https://chromium-review.googlesource.com/c/chromium/src/+/747801 this command leads to an error: >ninja -C out\debug_component obj/base/base_unittests/safe_numerics_unittest.obj FAILED: obj/base/base_unittests/safe_numerics_unittest.obj ../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo /showIncludes @obj/base/base_unittests/safe_numerics_unittest.obj.rsp /c ../../base/safe_numerics_unittest.cc /Foobj/base/base_unittests/safe_numerics_unittest.obj /Fd"obj/base/base_unittests_cc.pdb" error: cannot mangle this built-in __float128 type yet 1 error generated. You can "git cl patch" the CL or just modify build\vs_toolchain.py with the fded569deab4287c1e58ddebfe477fdee192e9a3 hash. This is the 15.5 preview toolchain and headers (15063 SDK). Then, "gclient runhooks" "gn clean" "ninja ...".
,
Nov 2 2017
The reduction finished with this somewhat broken code:
template <class _Ty, _Ty _Val> struct A { static constexpr _Ty value = _Val; };
template <bool _Val> using bool_constant = A<bool, _Val>;
using false_type = bool_constant<false>;
template <bool> struct B;
struct C : false_type {};
template <class> struct is_floating_point : C {};
template <class _Ty>
constexpr bool is_floating_point_v = is_floating_point<_Ty>::value;
template <class _Ty> struct D : bool_constant<is_floating_point_v<_Ty>> {};
template <typename T> struct F {
using type = T;
static const bool value = D<type>::value;
};
template <typename, typename, class = void> struct G;
template <typename Dst, typename Src>
struct G<Dst, Src, B<F<Dst>::value>::type>;
template <typename> class StrictNumeric {
public:
template <typename Src> StrictNumeric(Src);
template <typename Dst, B<G<Dst, int>::value> = nullptr> operator Dst();
};
static_assert (StrictNumeric < int >(1) > 0
$ bin/clang -target i686-pc-win32 -c /tmp/a.cc
...
error: cannot mangle this built-in __float128 type yet
Now where does that __float128 come from?
,
Nov 2 2017
It shows in the AST dump: |-VarTemplateDecl 0x77447a0 <line:7:1, line:8:62> col:16 is_floating_point_v | |-TemplateTypeParmDecl 0x77446a8 <line:7:11, col:17> col:17 referenced class depth 0 index 0 _Ty | |-VarDecl 0x7744740 <line:8:1, col:62> col:16 is_floating_point_v 'const _Bool' constexpr cinit | | `-DependentScopeDeclRefExpr 0x77448f8 <col:38, col:62> '<dependent type>' lvalue | |-VarTemplateSpecializationDecl 0x774e158 <col:1, col:62> col:16 referenced is_floating_point_v 'const _Bool' constexpr cinit | | |-TemplateArgument type 'float' | | `-ImplicitCastExpr 0x774e778 <col:38, col:62> '_Bool':'_Bool' <LValueToRValue> | | `-DeclRefExpr 0x774e740 <col:38, col:62> 'const _Bool':'const _Bool' lvalue Var 0x7744008 'value' 'const _Bool':'const _Bool' | |-VarTemplateSpecializationDecl 0x77536d8 <col:1, col:62> col:16 referenced is_floating_point_v 'const _Bool' constexpr cinit | | |-TemplateArgument type 'double' | | `-ImplicitCastExpr 0x7753cf8 <col:38, col:62> '_Bool':'_Bool' <LValueToRValue> | | `-DeclRefExpr 0x7753cc0 <col:38, col:62> 'const _Bool':'const _Bool' lvalue Var 0x7744008 'value' 'const _Bool':'const _Bool' | |-VarTemplateSpecializationDecl 0x7759c00 <col:1, col:62> col:16 referenced is_floating_point_v 'const _Bool' constexpr cinit | | |-TemplateArgument type 'long double' | | `-ImplicitCastExpr 0x775a228 <col:38, col:62> '_Bool':'_Bool' <LValueToRValue> | | `-DeclRefExpr 0x775a1f0 <col:38, col:62> 'const _Bool':'const _Bool' lvalue Var 0x7744008 'value' 'const _Bool':'const _Bool' | |-VarTemplateSpecializationDecl 0x7756288 <col:1, col:62> col:16 referenced is_floating_point_v 'const _Bool' constexpr cinit | | |-TemplateArgument type '__float128' <---------------------- | | `-ImplicitCastExpr 0x7760c40 <col:38, col:62> '_Bool':'_Bool' <LValueToRValue> | | `-DeclRefExpr 0x7760c08 <col:38, col:62> 'const _Bool':'const _Bool' lvalue Var 0x7744008 'value' 'const _Bool':'const _Bool'
,
Nov 2 2017
Shorter repro:
template <bool> struct B;
template <class T> constexpr bool is_floating_point_v = false;
struct StrictNumeric {
StrictNumeric(int);
template <typename Dst, B<is_floating_point_v<Dst>> = nullptr> operator Dst();
};
static_assert(StrictNumeric(1) > 0);
,
Nov 2 2017
The compiler is trying to perform implicit conversion of the StrictNumeric object to something that works with the > expression, which means instantiating the conversion operator template, which in turn means instantiating the variable template is_float_point_v. This is driven from addGenericBinaryArithmeticOverloads(). I suspect it's incorrect that it tries Float128Ty when that's not a type supported by the target.
,
Nov 2 2017
,
Nov 27 2017
|
||
►
Sign in to add a comment |
||
Comment 1 by h...@chromium.org
, Nov 2 2017Labels: OS-Windows
Owner: h...@chromium.org
Status: Started (was: Untriaged)