<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/119953>119953</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang compiles an invalid program normally
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ZY546
</td>
</tr>
</table>
<pre>
https://godbolt.org/z/jETK87bq7
```c
int func_2(); //note: previous declaration of 'func_2' with type 'int(void)'
int func_1() { return func_2();}
int func_2(int a) { //error: conflicting types for 'func_2'; have 'int(int)'
return 8;
}
int main() {
return func_1();
}
```
Clang compiles the program normally, and the resulting program can be executed.
Expected behavior (like gcc):
```
Could not execute the program
Build failed
Compiler returned: 1
Compiler stderr
<source>:4:5: error: conflicting types for 'func_2'; have 'int(int)'
4 | int func_2(int a) {
| ^~~~~~
<source>:2:5: note: previous declaration of 'func_2' with type 'int(void)'
2 | int func_2();
| ^~~~~~
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyslDGT8jYQhn_Nutn5GFu2T3bhwnDQpE2TNBlZWmxdhEQkmdylyG_PyOCDcPN1xzAIW7vvPiu9syIEPVqiDuot1K-ZmOPkfPf7b3X1kg1OfXRTjOcAZQ_sAOwwOjU4EzfOj8AO_wA7vO1__aXhw18c8h5e8utXQt5rG_E4W_kHA9YAa6HcIl5VrIsEZY9nTxft5oCKpBFeRO0suiMC42smx791nDB-nCm91jYCay5Oq6TI-GOd4loHgW_RU5y9fa4P_PUZLD2INetKR947n_Cks0ejZdR2XAACHp3_H1zqaRKXB7Tl90aGiCtIk6rn_R3gJLS98y7Bj8zFnXnN-jzc9D_vd0bYEaU7nbWhgHEiPHs3enFC6_xJGPMBbIfCqmXPU5jN0skaJYXFgZDeSc6R1OYqC3m_fz-TjKRwoElc9NJyY_SfhKOUC1T_hLNzs1FoXVzVHnGuottZG4VHoQ2pWwNXdH_rm1Q68uJxI0RF3t-4yl1ws5cE5R7KvoKyr1PCt15WhcB3-FN_3KJwiYJ6_2_6fGVjK9u32jzVZV_5Pk1yJ1vWB7r1ojLVlaotW5FRV_CyKuq2KVg2da0cKnrhR6WqhqSo5EC8yoeqKiRvmKBMdyxnVcGKKud5WbKNkKo95ryhulWcSw5VTiehzcaYyykNh0yHMFNXFG1bl5kRA5mwzBjGZDIuMJbGje9Swo9hHgNUudEhhrtE1NFQ9-RzYVHbizBafbF7NnvzPK50nOZhI90J2CEJ35YfZ-_eSEZghwU0ADvcWC8d-y8AAP__TMyISw">