[llvm-bugs] [Bug 46960] New: Templated "constexpr auto" variable cannot be used for SFINAE

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 2 03:07:54 PDT 2020


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

            Bug ID: 46960
           Summary: Templated "constexpr auto" variable cannot be used for
                    SFINAE
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: d25fe0be at outlook.com
                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

Not sure if they're the same, but it looks like that this one is related to Bug
43459 . 

The following snippet compiles on Clang 8, but fails on Clang 9+ (up to trunk),
complaining "value of type 'const auto' is not implicitly convertible to
'bool'":

```cpp
#include <type_traits>

template <class T> struct C {
    template <class U>
    static constexpr auto constant_bool_v = sizeof(U) <= 4;

    template <class U, class = std::enable_if_t<constant_bool_v<T>>>
    C(U) {}
};

C<int> vvv('c');
```

Live demo: https://wandbox.org/permlink/b3r89SL8wZ8xyrzc

-- 
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/20200802/30cf626b/attachment.html>


More information about the llvm-bugs mailing list