[llvm-bugs] [Bug 44656] New: [concepts] __is_convertible_to, requires-clause, and variable template interact poorly

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 24 19:01:12 PST 2020


            Bug ID: 44656
           Summary: [concepts] __is_convertible_to, requires-clause, and
                    variable template interact poorly
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Casey at Carter.net
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Created attachment 23062
  --> https://bugs.llvm.org/attachment.cgi?id=23062&action=edit

Compiling this well-formed TU:

  template <class, class> inline constexpr bool is_same_v = false;
  template <class T> inline constexpr bool is_same_v<T, T> = true;

  template <class T, class U>
  concept same_as = is_same_v<T, U>;

  struct invalid;

  template <class T, class U = invalid>
  struct ConvertsFrom {
  #ifndef WORKAROUND
      ConvertsFrom(U) requires(!is_same_v<U, invalid>);
      ConvertsFrom(U) requires(!same_as<U, invalid>);

  static_assert(__is_convertible_to(int, ConvertsFrom<int>));

with "clang -std=c++2a" diagnoses:

  repro.cpp:19:1: error: static_assert failed due to requirement
'__is_convertible_to(int, ConvertsFrom<int, invalid>)'
  static_assert(__is_convertible_to(int, ConvertsFrom<int>));
  ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.

with "-DWORKAROUND", the TU compiles correctly.

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/20200125/2606d9d0/attachment-0001.html>

More information about the llvm-bugs mailing list