<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/59542>59542</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Inconsistent error in one of two similar function declarations
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Fedr
</td>
</tr>
</table>
<pre>
Please consider the program as follows
```
template<typename T>
struct A {
constexpr A(int) {}
constexpr A(char) : A(0) {}
~A() { T::foo(); }
};
struct incomplete_type;
void good(A<incomplete_type> =0); // accepted by GCC and Clang
void bad(A<incomplete_type> ='x');// accepted by GCC, rejected by Clang
```
Function declaration `good` is accepted, but similar declaration `bad` does not:
```
error: incomplete type 'incomplete_type' named in nested name specifier
~A() { T::foo(); }
^~~
note: in instantiation of member function 'A<incomplete_type>::~A' requested here
constexpr A(char) : A(0) {}
^
note: forward declaration of 'incomplete_type'
struct incomplete_type;
```
Online demo: https://gcc.godbolt.org/z/9qWbzGTKn
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVD2P4zYQ_TWjZnCGRFkfLlR4besQpEiKA1IGFDmSGVCkjqTOt1fsbw8oeb27jhMEiWBYIjmc997MI7n3ajBEDRRPUBwTPoezdU1L0iWdlc_Nr5q4JxTWeCXJYTgTTs4Ojo_IPfZWa3vxkB4h3UOZXn_LMNA4aR4I8kN4nsjwkfAL5Kd11Qc3i4B7hOppnUHEBSfQ98nhHlitTAC2WyKq498FiTN3S1S-X8bpoy0vceW6EEnsId_31q6TkD_hLTp-5FdGH5gqI-w4aQr0e5RzC_pmlcTBWgms3kN--EvcCSE_pq84rAXWIheCpkASu2f8fDggNxIPmpvhXc6O_3NKYNV3YNWa-HFeYAd09AeJ69Q7iLtmrf_tbERQ1qAkobnjyzeU6SKvTFH5G0JM3c0BvRqV5u5-RyRfpigteTQ2xIo_giXnrIude5OIUSICq-5VswqjhyQqg4Z8lLR4yk8kVK_I_Zd249sDxenlZZ01Nto2skJlfOAmqFWZ7XGksSOH_WupgFWPe7TCRioVOvo6r5TP5Oh_WfnRA8XpI_Heugt38kNXbP-4qv_K5Xd9-8VoZQgljTbCnUOYfNS7uHAQYjNY2VkdNtYNwNofwNrd19-6H5-__GwS2eRyl-94Qk1WVllWl1leJudGpLu668pU5Ixnsu-zvqqrragyRl1aVDJRDUsZy1hWZvFdbkRRdbKv8zrrGav7DLYpjVzpjdbfxoidKO9naopdsWWJ5h1pv1x1jBm64LIIjMWbzzVxz6duHjxsU6188G9Zggqamp_Mcg36QCbg4txoEGsoljZc7O0s9A-OkU9mp5u7QqlwnruNsCOwNoJdX58mZ-OhBdYuFD2wdpHwZwAAAP__Yc-1kA">