<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61823>61823</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
type-constraint masks friendship
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++20,
clang:frontend,
rejects-valid,
concepts
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
cjdb
</td>
</tr>
</table>
<pre>
GCC test `concepts-friend3.C` fails. Note that despite being isomorphic, `f` is diagnosed, while `g` is not.
```cpp
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
template <class T> concept True = true;
template <True U> void f() { ++U::x; }
template <class U> void g() requires True<U> { ++U::x; }
template <class V> class C
{
static int x;
template <True U> friend void f();
template <class U> friend void g() requires True<U>;
};
int main()
{
f<C<int>>();
g<C<int>>();
}
```
Diagnostic:
```
<source>:5:35: error: 'x' is a private member of 'C<int>'
template <True U> void f() { ++U::x; }
^
<source>:19:3: note: in instantiation of function template specialization 'f<C<int>>' requested here
f<C<int>>();
^
<source>:10:14: note: implicitly declared private here
static int x;
^
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVE1z4jgQ_TXtSxeULWEcDj6ASfY2h63JXrdkqW00KySvJLNhf_2WjAeSFGwuk0rJpj9ev9dqtwhB95aohnIH5T4TYzw4X8sfqs1ap871b02DkUJEWOfSWUlDDIvOa7KKLxtY59gJbcISv7lIGA8ioqIw6EjYkrY96uCOzg8HLYE1CaVLSTqg0qK3LpBK9n8O2lDy9rPXuriEfA_5Ftb55V8Ow2xhL8Be8PfXb8C3CKyURtj-TykLXISogO8lsB2wHctx0YWzjeJt4aw54-JEXnfnlBNmrOmMdByMiITAG2lECPgd-DPOgvG7H5Nrj9GPBHz3KHWKe02ZJ6cVdsCegG0Qqh1eCL0C3wLfvgHfIVT7R8VvEP0M4envUXsKExXgzRTxBe4j9D8madNrM0dWsyTEEEXUErWN-PZJKeJ9rZdp-CD5mokPxL3P-T-NNwrV_hOdRPEotJ0rfhbSAW8a4I22ccJ5_sys_yLg1sefA3j5ub_MbdQyNf1eBPAmuNFLmnC3JfAtTweS985fZrZ6A1alQRc4eH1KHTrSsSWPrkvud8xY9asmDaF8vkux2CSOiZl1kdJTW9Q2RGGjFlE7m2h1o5XT-5VJGEhqYfS_lxhg1Z22V9PNUoik8ECeZi5fXtBjtnk6Vh_oHgejpY7mjIqkEZ7Uta_vat4fb3z_dyv68VIzVXO14RuRUV2sn_KC56uyzA51UXSlkKpaFZu8VNWKM7YpZCvbSsmWqi7TNcsZzznbMFauinK5bqmgnG2o2zypcqVgldNRaLM05nRcOt9nOoSR6nXxxHhmREsmTAuasetiA8aANcmSdh_wbeedjWTV1eHpB8kYFidh9M36c4cnQ7nPfJ1qLtqxD7DKjQ4x3FhEHQ3V8TzQQjoboheXby78FeYPOBz0kI3e1IcYh5BGblrNvY6HsV1KdwT2kuDmx2LwLpEC9jIpDMBeJpH_BQAA__-FgN5K">