Skip to content

clang-cl "cannot mangle this built-in __float128 type" due to promotions #34522

@zmodem

Description

@zmodem
Bugzilla Link 35174
Resolution FIXED
Resolved on Nov 15, 2017 09:12
Version trunk
OS Linux
CC @DougGregor,@dpxf,@zygoloid,@rnk

Extended Description

$ cat /tmp/a.cc
template struct B;
template constexpr bool is_floating_point_v = false;

struct StrictNumeric {
StrictNumeric(int);
template <typename Dst, B<is_floating_point_v> = nullptr> operator Dst();
};

static_assert(StrictNumeric(1) > 0);

$ bin/clang -cc1 -triple i686-pc-win32 /tmp/a.cc -std=c++17 -emit-obj

error: cannot mangle this built-in __float128 type yet
/tmp/a.cc:9:32: error: invalid operands to binary expression ('StrictNumeric' and 'int')
static_assert(StrictNumeric(1) > 0);
~~~~~~~~~~~~~~~~ ^ ~
2 errors generated.

Note that the source never mentions __float128, but Clang tries to use it when it tries to find a conversion of the StrictNumeric that works with the > expression. In the process, it instantiates is_floating_point_v<__float128>, causing the mangling error.

Should BuiltinOperatorOverloadBuilder::addGenericBinaryArithmeticOverloads() only consider types that are valid for the target?

(We hit this in Chromium with the latest MS SDK; see http://crbug.com/780311)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions