<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/65053>65053</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Overload resolution fails for `__declspec(property)` access in expression-list of new-placement
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Sirraide
</td>
</tr>
</table>
<pre>
The following code (also on [godbolt](https://godbolt.org/z/nnMhb3MzM)) using the MS `__declspec(property)` extension fails to compile due to overload resolution failure
```c++
#include <new>
struct S {
int get_value() { return 42; }
__declspec(property(get = get_value)) int i;
void* operator new(std::size_t, int);
};
void foo(int);
int main() {
S s;
foo(s.i); // ok
new (s.i) S; // error: no matching function for call to 'operator new'
}
```
with the following error message:
```
<source>:14:5: error: no matching function for call to 'operator new'
14 | new (s.i) S; // error: no matching function for call to 'operator new'
| ^ ~~~~~
<source>:6:10: note: candidate function not viable: no known conversion from '<pseudo-object type>' to 'int' for 2nd argument
6 | void* operator new(std::size_t, int);
| ^
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VM2O4jgQfpriUuqWsUlCDjnwM9xae2DvLceuBO8YO7IdmO7DPvvKgQa6NaOVdjUoMiSpqu-nipIxmt4RNVCsodjO5JgOPjR7E4I0mmat12_NnwfCzlvrz8b1qLwmBL6UNnr0DqFY91633iYotsCXh5SGCGIFfAd8d3317EMPfPcOfOfcy6EVL-8vwGvgNY4xV00Hwpc9QsleXzUpGwdSwJdD8AOF9JZjS4b0I5GLxjvspLERk0flj4OxhHqkfOtPFKyXGgNFb8f0ETsGArYFtrqeJbtcCvg6X5enXBin7JgFio2jM4hvj1kxhVEl3CNU1wxENC5hT-n1JO1IwJdZE1RrDJTG4HDBQawRqu0t4RcClz0lBLF9LDYZlAEMiDviyRsNfIU5UyYfMDPly5h0tl2sonmn1wR8k1NzkY_czOL2ezpzKey8B778GjudGfsojbvrurHAPcZHVtcy8dlcyuRHlxlA__0a5eiMtxjcT85cQigEH0Cs0Hk8yqQOeSi60alLB31AJa3NHQZefRZe3cV97u2jkLNJh2nI7oM8QeKRYpQ9Zed-Nh_XW7GJfgyK8kCI1XwBYlVktv-fNiLOFwjVJvv1Ww2aAG5IUHxDxL_z56cay6yTXQBTtgeVdNpomegO63zCk5GtpSuz786fHSrvThQu_9Pgj5kRiM0QadT-ybd_kUqY3oYJiVdXztP8VZMS7jTK0I9HcunOvfzg_p_n_7MDDzYgfmn7TDdC16KWM2rmZS14NWeMzQ5NWc61klXbdqJU1OklJ1Z3omip7apC6JlpOOOCLXnN5kzM62fGSiGKrqhrJnXHOCwYHaWxz9aejnkvzkyMIzVlwQoxs7IlG6d1zHmehuklcJ63c2hyzlM79hEWzJqY4r1KMslOe1xZ6XootvjHL3ZhnEz-l1UrlaIY0TikH0OgmLv5lCHRd9nwp8FKRblDszHY5svWN-kwts_KH4HvMsPr19MQfO4-8N2kKwLfTbr_CQAA__919_QE">