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

            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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

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

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 {
      ConvertsFrom(T);
  #ifndef WORKAROUND
      ConvertsFrom(U) requires(!is_same_v<U, invalid>);
  #else
      ConvertsFrom(U) requires(!same_as<U, invalid>);
  #endif
  };

  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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to