<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/86559>86559</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] attribute on constructor causes -> to be incorrectly inferred as trailing return type in base class argument list
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
joelhock
</td>
</tr>
</table>
<pre>
version 17.0.1 correctly formats this:
```c++
// --dump-config has
// AttributeMacros:
// - _COLD
#define _COLD __attribute__((cold))
class C {
public:
__attribute__((cold)) Node() : Base(obj->func()) {} // OK
_COLD Node() : Base(obj->func()) {} // OK
Node() : Base(obj->func()) {} // OK
};
```
whereas 18.1 and HEAD (d99cfa053998483) incorrectly think `->` is introducing a trailing return type when the constructor has an attribute attached to it:
```c++
// --dump-config has
// AttributeMacros:
// - _COLD
#define _COLD __attribute__((cold))
class C {
public:
__attribute__((cold)) Node() : Base(obj -> func()) {} // WRONG
_COLD Node() : Base(obj -> func()) {} // WRONG
Node() : Base(obj->func()) {} // OK
};
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVM-PmzoQ_mvMZUQEdgjmwCFZNu9J73VX6qXHyNgDOOvYkW12tf99BWR_pKpWrdreKo3AzGi-Gb75PCIE3VvEmhQ7UjSJGOPgfH10aAYnH5LWqef6EX3QzkJerrJVDtJ5jzKaZ-icP4kYIA46ELYlWUOyLdlki0lCd5MtXrondA9pqsbTOZXOdrqHQYSr6DZGr9sx4ichvXsHuYQhhcPN_f_Ni5Mp7LTFxQmHg3hJPxwI5YRy6YwitJpsSZmf0ogQ4AZIeekN4Dy2RsvXeh9jwZ1TODsrIGwLOxGmT9ceU8Juu9HKJTjHyx0pG4DLH9z_91IRLl3_HqxfRyFlQ9jumwm-Z-1pQI8iQM5XOQir4N_bbQOEclVVshNZwaqKrzmbamj7ppE4aPsAZJNNrZBNBjqAttE7NUptexAQvdBmOnqMo7cQn88ITwNaiAOCdDZEP8ro_KQXEBZeZzOdhBxQQXSg418JtkeYaIYPR_7l8_3dPz-sw58H_ENiTFTNVMUqkWCdl3nOKkpzmgw1yzuZiY4p1rZroZjgOeeKbTjnm2IjukTXNKPrjNEi52vG6CqnJa-QcoFKllJxss7wJLRZGfN4WjnfJzqEEWu-KYoqMaJFE-YNSak0wvbpsvgIpdPO9PWUlrZjH8g6MzrE8AYUdTTzdr1KLJp3Inb2SuRSjAHDQnt00OLVddK2Q-9RgQjfvzjaQisCwiIx4fvxhDbC1FYyelMPMZ5nWc-U9zoOY7uS7kTofmr68krP3h1RRkL3MxWB0P3MxtcAAAD__-NFw88">