<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/70070>70070</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Template deduction guides don't work with Objective-C declared properties
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zetafunction
</td>
</tr>
</table>
<pre>
Sample code that doesn't work:
```
#include <stddef.h>
#include <iterator>
template <typename T>
class Span {
public:
Span(T*) {}
};
template <typename It,
typename T = std::remove_reference_t<std::iter_reference_t<It>>>
Span(It) -> Span<T>;
@interface MyInterface
@property char* data;
@end
void F(MyInterface* interface) {
Span s(interface.data); // doesn't work
Span<char> s2(interface.data); // works
Span<char> s3([interface data]); // works
}
```
This produces:
```
<source>:21:10: error: no viable constructor or deduction guide for deduction of template arguments of 'Span'
21 | Span s(interface.data); // doesn't work
| ^
<source>:13:1: note: candidate template ignored: couldn't infer template argument 'It'
13 | Span(It) -> Span<T>;
| ^
<source>:6:7: note: candidate template ignored: could not match 'Span<T>' against '<pseudo-object type>'
6 | class Span {
| ^
<source>:8:3: note: candidate template ignored: could not match 'T *' against '<pseudo-object type>'
8 | Span(T*) {}
| ^
```
Godbolt: https://godbolt.org/z/3Y7v1zW7K
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyklUFv6zYMgH8NcyEa2FIcxQcf3KQZimHY4RUYdnqQLTrW5liGJKdof_0g2U3aLF338ALDjkWK_EiRtHROH3qiArJ7yHYLOfrW2OKVvGzGvvba9IvKqJfimzwOHWFtFKFvpUdlyPXAhMdnY_8GXkKyg6SEdTJf0yvjuq-7UREC3zqvFDXLFvjDLL6hpD1Z6Y29UvJ0HDrpo4p_GaiXR8Kns1LdSefw2yB7BHE_reEwVp2uz2xRDGzzBKwElkdFsZudiB3w-y8dPnpg29na-XfBQeA7dF4Fl7y0dDQn-m6pIUt9Td_9lIN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