<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61500>61500</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang disallows having a pointer to subobject as a template argument
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
brevzin
</td>
</tr>
</table>
<pre>
Short example:
```cpp
template <int const*>
constexpr int f()
{
return 0;
}
struct X { int i; };
constexpr auto x = X{.i=1};
constexpr int xs = f<&x.i>();
```
Clang rejects (every version I've tried), saying:
> candidate template ignored: invalid explicitly-specified argument for 1st template parameter
But `&x.i` should meet all the requirements here - it is a pointer to `int const` and the object in question does have static storage duration (so it should be a permitted result of a constant expression).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsU0-P-ygM_TTkYrWi0DTNIYf-mUp73stcSXASVgQyYDrtfvoVaTudlX5SRBA8v2c_GxWjGRxiw8ojK8-FSjT60LQBr_8aV7Re35u_Rx8I8Kam2SKTB8bPjB_Yjj--bp4fJ4TTbBUhMHkyjqDzLhITByY_HoDlAG9zgHzdM7Fnon6yVcfHBgAgIKXggDN5fN2en5tljRRSR_AJrDouVIbJI2TQK-CtpBJ5uAGTZ_hk1XFtmDxv_gzNTLe4QHsmT0zsbhn-8czzJ5lX4b9TOlnlBgj4D3YUgYk9XjHc4YohGu_gLyaqKwIFgzpziRNEdTdueNv5WOUHdMppo7OPP4aawfmAmskDGHdV1mjA22xNZ8jeV3HGzvQGNagwpAmztz7AJtKbYVZBTUgYfqsdE0Gu41HojkMcfbIaJkQCZS3QiBDwK5mAmTbCiAFhBYbARFAwe-MIA5DPPO-e7zgop5dw32ZLwDj4Shgpm6E9RhjVFSGSItNBJB_UgKBTUAuCiX30WeWZUItZDMNkiFBDwJgsge9BPQSVy_M5B4zZbSbqNRS6kbqWtSqw2eyqelMJXopibLpysy9VWfKu67Z9td-2Zb3HXlU91n3VtYVpBBeSy81e8C0vxbqsayl3Jbao6hZRsy3HSRm7tvY6rX0YChNjwma3KTkvrGrRxuU9CeHwG5ZLJkR-XqHJMas2DZFtuTWR4puFDFlsumWStInKWv-9GGXc8H-zY2qfvqrchp8uv_pfpGCbkWiOeb7EhYnLYGhM7brzExOXLPn8rebgMxMTlyXRyMRlKeS_AAAA__9La02s">