<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Defaulted comparisons deleted for class containing class containing class template with user-provided operator<=> with deduced return type"
   href="https://bugs.llvm.org/show_bug.cgi?id=44723">44723</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Defaulted comparisons deleted for class containing class containing class template with user-provided operator<=> with deduced return type
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++2a
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>david@doublewise.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following valid code:


```
#include <compare>

template<int>
struct a {
        friend constexpr auto operator<=>(a const & lhs, a const & rhs) {
                return std::strong_ordering::equal;
        }
};

struct b {
        friend auto operator<=>(b const &, b const &) = default;
        a<0> m_value;
};

struct c {
        friend auto operator<=>(c const &, c const &) = default;
        a<0> m_value;
};
auto x = c() <=> c();
```

is rejected with the message:

```
main.cpp:11:14: warning: explicitly defaulted three-way comparison operator is
implicitly deleted [-Wdefaulted-function-deleted]
        friend auto operator<=>(b const &, b const &) = default;
                    ^
main.cpp:12:7: note: return type of defaulted 'operator<=>' cannot be deduced
because return type 'auto' of three-way comparison for member 'm_value' is not
a standard comparison category type
        a<0> m_value;
             ^
main.cpp:5:24: note: selected 'operator<=>' for member 'm_value' declared here
        friend constexpr auto operator<=>(a const & lhs, a const & rhs) {
                              ^
main.cpp:16:14: warning: explicitly defaulted three-way comparison operator is
implicitly deleted [-Wdefaulted-function-deleted]
        friend auto operator<=>(c const &, c const &) = default;
                    ^
main.cpp:17:7: note: return type of defaulted 'operator<=>' cannot be deduced
because return type 'auto' of three-way comparison for member 'm_value' is not
a standard comparison category type
        a<0> m_value;
             ^
main.cpp:5:24: note: selected 'operator<=>' for member 'm_value' declared here
        friend constexpr auto operator<=>(a const & lhs, a const & rhs) {
                              ^
main.cpp:19:14: error: overload resolution selected deleted operator '<=>'
auto x = c() <=> c();
         ~~~ ^   ~~~
main.cpp:16:14: note: candidate function has been implicitly deleted
        friend auto operator<=>(c const &, c const &) = default;
                    ^
2 warnings and 1 error generated.
```</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>