<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63005>63005</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            std::__detail::__common_cmp_cat' has different definitions in different modules
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          yudaichen
      </td>
    </tr>
</table>

<pre>
    clang version: 17
c++ version:20 
use modules

Please help me take a look, big brother.It seems that there is a global runtime computed code snippet with 'constexpr' in the 'compare' file '__common_cmp_cat', which leads to compilation failure.

```
In module 'map_util' imported from /mnt/e/development/openSource/fast_experience/test/simple.cpp:31:
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/compare:398:22: error: 'std::__detail::__common_cmp_cat' has different definitions in different modules; definition in module 'map_util.<global>' first difference is function body
      constexpr auto __common_cmp_cat()
 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/compare:398:22: note: but in '' found a different body
      constexpr auto __common_cmp_cat()
      ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In module 'small_utils' imported from /mnt/e/development/openSource/fast_experience/test/simple.cpp:28:
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/compare:398:22: error: 'std::__detail::__common_cmp_cat' has different definitions in different modules; definition in module 'small_utils.<global>' first difference is function body
      constexpr auto __common_cmp_cat()
 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/compare:398:22: note: but in '' found a different body
      constexpr auto __common_cmp_cat()
      ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In module 'message_bus' imported from /mnt/e/development/openSource/fast_experience/test/simple.cpp:32:
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/compare:398:22: error: 'std::__detail::__common_cmp_cat' has different definitions in different modules; definition in module 'message_bus.<global>' first difference is function body
      constexpr auto __common_cmp_cat()
 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/compare:398:22: note: but in '' found a different body
      constexpr auto __common_cmp_cat()
      ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In module 'range_utils' imported from /mnt/e/development/openSource/fast_experience/test/simple.cpp:30:
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/compare:398:22: error: 'std::__detail::__common_cmp_cat' has different definitions in different modules; definition in module 'range_utils.<global>' first difference is function body
      constexpr auto __common_cmp_cat()
 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/compare:398:22: note: but in '' found a different body
      constexpr auto __common_cmp_cat()
      ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In module 'fast_mutex' imported from /mnt/e/development/openSource/fast_experience/test/simple.cpp:29:
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/compare:398:22: error: 'std::__detail::__common_cmp_cat' has different definitions in different modules; definition in module 'fast_mutex.<global>' first difference is function body
      constexpr auto __common_cmp_cat()
 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/compare:398:22: note: but in '' found a different body
      constexpr auto __common_cmp_cat()
 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
```

libc++ std::__detail::__common_cmp_cat
```
 namespace __detail
  {
 template<typename _Tp>
      inline constexpr unsigned __cmp_cat_id = 1;
    template<>
      inline constexpr unsigned __cmp_cat_id<partial_ordering> = 2;
    template<>
      inline constexpr unsigned __cmp_cat_id<weak_ordering> = 4;
    template<>
 inline constexpr unsigned __cmp_cat_id<strong_ordering> = 8;

 template<typename... _Ts>
      constexpr auto __common_cmp_cat()
 {
        constexpr unsigned __cats = (__cmp_cat_id<_Ts> | ...);
        // If any Ti is not a comparison category type, U is void.
        if constexpr (__cats & 1)
          return;
        // Otherwise, if at least one Ti is std::partial_ordering,
        // U is std::partial_ordering.
        else if constexpr (bool(__cats & __cmp_cat_id<partial_ordering>))
          return partial_ordering::equivalent;
        // Otherwise, if at least one Ti is std::weak_ordering,
        // U is std::weak_ordering.
        else if constexpr (bool(__cats & __cmp_cat_id<weak_ordering>))
          return weak_ordering::equivalent;
        // Otherwise, U is std::strong_ordering.
        else
          return strong_ordering::equivalent;
      }
  } // namespace __detail
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWE1v2zgQ_TX0ZRBBJi3bOviQOBXQ0y6w7VmgpJHELUVq-eEkl_72BSXbsexkm243XRSwECj2cDjz5nGeRJNbKxqFuCHJHUnuZ9y7VpvNk6-4KFtUs0JXT5tSctXADo0VWhF2C_MVie9JfFsSekfo3ckQjWEc8hah05WXaEfDeP9dIrcILcoeOgTHvyBwkFp_IXQLhWigMNq1aKKPDixiZ8G13EEwIQgLHBqpCy7BeOVEh1DqrvcOKyh1hWCV6Ht08CBcC4SuSq2sw8feELoCoUKc0dz13GAw1kIOpjwvdddplZddn5fcEboKkB5aUbYgkVcWnB6yCcmd0ApqLqQ3GJ3WR5bx_m_4-lHtSQgZOt7n3gk5QOl6bQLq2ugOCM065QjNkNCswh1K3Xc4WHSP6g_tTRmGam5djo89GoFqsDi0wcuKrpcYlX1P2C2bE3aAQzNvDaFZIRShWRQRmklREJo1ZUlo9rhe5svFjRTKP940yhOazdnB8ewmVCl9FZLul_3gfCCT3bJ0HXqAhh5BY7QJHwhdWVcFSOw2zyt0XMjDtwvKoeUWKlHXaFA5qLAWSgS2bVi954FDa7G7E5_gckl3RNh27BnCPowrbqw7xiqHtqq9KocQoeFH7mC4jg0E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