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

            Bug ID: 50276
           Summary: [concepts] error: out-of-line definition of 'length'
                    from class 'utf_t<type-parameter-0-0>' without
                    definition
           Product: clang
           Version: trunk
          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]

$ cat utf.cpp
#include <concepts>

template <typename>
struct utf_t;

template <typename T>
    requires (std::is_same_v<T, char32_t>) ||
             (std::is_same_v<T, wchar_t> && sizeof(wchar_t) ==
sizeof(char32_t))
struct utf_t<T> {
  utf_t() {
  }

  template <typename Input>
  static auto length(Input begin, Input const end) -> unsigned;
};

template <typename T>
    requires (std::is_same_v<T, char32_t>) ||
             (std::is_same_v<T, wchar_t> && sizeof(wchar_t) ==
sizeof(char32_t))
template <typename Input>
inline auto utf_t<T>::length(Input begin, Input const end) -> unsigned {
  return 0;
}

$ clang++ -std=c++20 utf.cpp
utf.cpp:21:23: error: out-of-line definition of 'length' from class
'utf_t<type-parameter-0-0>' without definition
inline auto utf_t<T>::length(Input begin, Input const end) -> unsigned {
            ~~~~~~~~~~^
1 error generated.

No matter how you constrain it, it doesn't work:
https://godbolt.org/z/qqaM89nTx

GCC compiles it without any error: https://godbolt.org/z/PM3seoYvW

-- 
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