<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/87490>87490</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Objective-C encoding of `BOOL*` is wrong
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
madsmtm
</td>
</tr>
</table>
<pre>
The following program:
```objective-c
#import <stdio.h>
typedef signed char BOOL;
typedef signed char TYPEDEF;
int main() {
printf("signed char* encoding: %s\n", @encode(signed char*));
printf("TYPEDEF* encoding: %s\n", @encode(TYPEDEF*));
printf("BOOL* encoding: %s\n", @encode(BOOL*));
return 0;
}
```
Is supposed to output the following on x86_64 ([godbolt Clang 15](https://godbolt.org/z/dYrsheGd9), [Godbolt GCC 13.2](https://godbolt.org/z/zaj3hdqPo)):
```
signed char* encoding: *
TYPEDEF* encoding: *
BOOL* encoding: ^c
```
But since Clang 16, it outputs ([godbolt Clang 18](https://godbolt.org/z/9efxrnf3a)):
```
signed char* encoding: *
TYPEDEF* encoding: *
BOOL* encoding: *
```
---
Clang seemingly has code to support this, see https://github.com/llvm/llvm-project/blob/2bf7ddf06f773277fcfef58a3cd8c32a161ce36a/clang/lib/AST/ASTContext.cpp#L7696-L7704 and https://github.com/llvm/llvm-project/blob/2bf7ddf06f773277fcfef58a3cd8c32a161ce36a/clang/lib/AST/ASTContext.cpp#L8356-L8362, but for some reason these code paths are now no longer correctly triggered?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVU1v4zYQ_TXUZWBDIvV50CG2o6BAgCzQXPZUUORI4kIiVZLaJPvrC8pykg2SID21gEBDnpnnN2-eh9w51WvEmmQHkp0ivvjB2Hri0k1-ilojn-r7AaEz42gelO5htqa3fCLsisQnEl_OPD4_pv2BwqufuBNbhDI1zcZ6IOzovFRmPxB2_brYP80osYOVigQxcAuHu7tbwg4fJ9x__3Z9um6ec86n0h4mrjShJaEVkGKLwmyV9t36NX0FQ-gVoBZGKt0TdgWEZo5kR00oJfQIJI3XKBJa_l5FaBUe9h7-hdrXsV8qPsNdNfk66Jb-FhEALPrFaohfxCtOb-b4WtQ_HLhlno1DCd6AWfy8ePC_2cJoeCzzv_IUAtfs0BvZmtHDceS6hyQj2YnQcvB-dsE6tCG02XL2xvaENr8IbeR36wa8kSvj0E52uNmAbo5HSNiefg3oF__BBvn3N3Pp_q1Pz6-fOmEr-XCaW_zdqWTX4hNBD4sHp7TAizx5aFb5TVr3vobl11qvsHu0umP8P2qdvv9753O3271-PXfmECel-_EJBu4guDfYbLWcDT5TLsjjEOFN78oPS7sXZiK0Gcefl4_dbE3YQoQ27WhaQhvadoWUXZx3RcFoUXSiwy4rOROyFIzyJE8EspwT2ohAKQCpUHj15_35PBrt8dHvxTwTym6LvMp3t0URp8C1_P_wKlmW725Llq_boF08dMaCMxOCRe6MDn9bh2eRZ-4HB9wiaPMA2sBodI8WhLEWhR-fwFvV92hREtZEsmayYhWPsE6KhCZpRdMqGupUxFmJsihRcNbJlFYVl0KWcV6VCStEpGoa0zROY5awOE6zfcsrWpVC8jbFpKswbK2Jq3EfVApWjpRzC9ZlkVZxNPIWR7feUJRuMoQ1ENl6VbVdekfSeFTOuxcEr_y4XmvniuwEd89X0_HZsWA6IHl8WZV5DMrBgzW6jxY71v96ritvR2izUv8nAAD__74ZK3I">