[llvm-bugs] [Bug 46464] New: Cannot pass exact expression of `__int128_t()` or `__uint128_t()` as template argument

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 25 21:32:27 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46464

            Bug ID: 46464
           Summary: Cannot pass exact expression of `__int128_t()` or
                    `__uint128_t()` as template argument
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david at doublewise.net
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

In the following code, all lines are accepted except the two marked "fails".
The results are the same if `__int128_t` is replaced by `__uint128_t`. I would
expect this entire program to be valid.

```
constexpr auto x = __int128_t();
static_assert(__int128_t() == __int128_t(0), "");
int a[__int128_t()];

template<__int128_t>
void f() {
}

void g() {
    f<__int128_t(0)>();
    f<__int128_t() + __int128_t()>();
    f<+__int128_t()>();
    f<__int128_t()>(); // fails
    using T = __int128_t;
    f<T()>(); // fails
}
```

when compiled, outputs

```
<source>:13:5: error: no matching function for call to 'f'

    f<__int128_t()>(); // fails

    ^~~~~~~~~~~~~~~

<source>:6:6: note: candidate template ignored: invalid explicitly-specified
argument for 1st template parameter

void f() {

     ^

<source>:15:5: error: no matching function for call to 'f'

    f<T()>(); // fails

    ^~~~~~

<source>:6:6: note: candidate template ignored: invalid explicitly-specified
argument for 1st template parameter

void f() {

     ^

2 errors generated.

Compiler returned: 1
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200626/8a1451da/attachment-0001.html>


More information about the llvm-bugs mailing list