[llvm-bugs] [Bug 49711] New: non-type template parameter not working with clang, but working with gcc

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 24 05:57:04 PDT 2021


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

            Bug ID: 49711
           Summary: non-type template parameter not working with clang,
                    but working with gcc
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: janezz55 at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Created attachment 24689
  --> https://bugs.llvm.org/attachment.cgi?id=24689&action=edit
c++ file demonstrating bug

This is not working with clang-11.1.0, but working with gcc-10.2.0:

#include <functional>

template <auto op>
constexpr auto compare(auto const ...a) noexcept
{
  return op(a...);
}

int main()
{
  return compare<std::greater<int>{}>(1, 2);
}

clang++ -std=c++20 a.cpp -o a
a.cpp:11:10: error: no matching function for call to 'compare'
  return compare<std::greater<int>{}>(1, 2);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cpp:4:16: note: candidate template ignored: invalid explicitly-specified
argument for template parameter 'op'
constexpr auto compare(auto const ...a) noexcept
               ^
1 error generated.

-- 
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/20210324/dc2de7ae/attachment.html>


More information about the llvm-bugs mailing list