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

    <tr>
        <th>Summary</th>
        <td>
            Friended struct with concept gives different output in clang/gcc/MSVC 
        </td>
    </tr>

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

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

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

<pre>
    GCC bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107544

I don't know which compiler is right, but all three give a different output.

https://godbolt.org/z/7Pq3eWhc8

```
#include <compare>
#include <concepts>
#include <iostream>

template <class T>
concept HasTag = requires {
    T::Tag;
    requires std::same_as<decltype(T::Tag), const bool>;
};

template <class T>
struct check_tag final {
    static constexpr bool value()
        requires(!HasTag<T>)
    {
        return false;
    }

    static constexpr bool value()
        requires(HasTag<T>)
    {
        return T::Tag;
    };
};

struct S {
   private:
    template <class T>
    friend struct check_tag;
    static constexpr bool Tag = true;
};

int main() {
    std::cout << HasTag<S> << "\n";
    std::cout << check_tag<S>::value() << "\n";
}
```

Clang output (the concept sees private data if used in friend):
0
1

GCC output (the concept always sees private data):
1
1

MSVC output (the concept never sees private data):
0
0

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVUuPmzAQ_jXmYjXCmED2wGGbNG0PlSrtqj2uHDMB7zqGtU3S7a_vGEiWZB9V1cgxmBl_883D401TPhWfl0u66SpqoW2sJ_ya1t63Dl9IssZRSTmrTDdrbIUr1PyttBb46urmcIfrmawU4WtVEr5icT5PUxKvSHw9zF9p2RiS5J4-mOZAD7WSNZXNrlUaLFWOWlXVniSBhKdCa-prC0ArtQcqaKm2W7BgPG0633Z-NsW-INqUm0b7kehv_OffHzn8rOViuolk8TiGZcKVkborgRK-DMSEBcI_vS41Elrv3hCrxnkLYvcs7mcPu1YLPyBo4Ry9PWmMiPSLcLeiQo0V5uGxUxYcJfnHQYni7za4ya9RifDJ55Oy8-Wg4cQO7gRSXJYgtX9qgSSLye7kKsQa7TpPN02jA5UjIslXz-9_5Y7OdtJTWYN8uPPIfquM0Oe0nRdeycEc_Gptb5Luhe4CrUDmpDp1p5exIShoubc51T2zMWz0nTV0K7SDswAFlyb-_B-nfyf0RtrOAv0i6GNgb85QW6v2mIiAd4J5LztBvrUKTEkvE3VG5fVoHIsRd8I7TBWey51QZojbZerHipR4cgNDHPQUwRskevxIkoTMlyY8-N8AJk70GIPGJHnvgD7XwkUL6OelFqYauwzuXvga6PF4OsAjNmaAlsILqra0c1BSZcYoh3I45mbEZVP40GZfBxf6IJ7cSxtTRPYK4rebH29BGthjc30XMT57RFCwLMvznCVJFpUFL6_4lYi88hqKde8gnArpoHx9MhX6tHvRpkNcZAjocIHg3LONOquLi66NYN1mho0XF1rvj48PrW3uQeLNsFbOdeH8reeLBedRXeQizhlPIM0FS9l2LhZpuhBZCpngbFuWkRYb0K4g84-YfwMH2kP0JbGKVJHEScJYnCUszeNsJjc5F2y-YIxdJfNsTtIYsKr1LPAI10lki54SXnYOhVo5756FeO5UZQB6c4gvOl83tiiFEQ_3UW-56Jn_AcVyJ6o">