<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56474>56474</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [debug-info] Should constructor homing not suppress types for empty default constructors?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jmorse
      </td>
    </tr>
</table>

<pre>
    Using a recent clang (02d6950d844db0), consider this code:

    class foo
    {
    public:
      foo() {}
    
    public:
      float bar;
    };
    
    float cheese(foo *baz) {
      return baz->bar;
    }

With constructor homing enabled, clang does not emit full type information for `foo`, because there's no call to the constructor. However, if you delete the declaration of the default-constructor, then it does!

I find this moderately unintuitive, because there's no functional change to the behaviour of the code, but there's substantially different debug-info being generated. It's not clear to me whether it's a bug though: a possible explanation is that the implicit default-constructor won't get a function symbol, therefore it doesn't qualify for constructor homing in a translation unit? This very much isn't my area of experience, so paging @dwblaikie and co, is this an expected behaviour of constructor homing?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyFVE1zmzAQ_TX4smMP5sPYBw5J3Uxzbjs9C7SAUiFRfdglv74r2a7JJJ0yHsMi7Xtv3y5qNJ_r71aoHhgYbFE5aCWjMMn2acZ3hzLl-6LgTZpkhyT7BK1WVnA04AZhKeKY5A9JekzS6z_QRRDWQqf1_VVSPd6DyTdStH8TIV5he7Ynmri3Oi5y_5MoNXPQMJPkj0vC49v479NlfzsgWiRG4qVqHxr2euNeYBt03igCf10n-eePOBal_xBuiAY541unDQx6DNaiYo1EHu2L5nKNFpR2gKNw0Hkpwc0TglCdNiNzQiuyw0CyS4MruzSkNtgyb5GMR0O6q4AALQu5OrxcMm_giz7jCU1IFB3M2gNHiS6m0yPpMBce3V1fdcxLt16AhFxaUkAag-Ik2y6rfYZOKH6Zg5HmgPBQzuCVUM4LJ074T9WdV20gZ5LaQIbgrYQGB3YS2pubrDhgAca7BYT1jXVMOUHVz8BF19EKjS7Hxvfr4CIhBed7VFEX38Czu7KHCUdmAuWIcB4w4FKNcZkRU09M2vcDjRnFk7ZWUPsAf0_UvItpVLIbWJQEYpxoJoNH7y2Es1aE60iII6xb3WDnsdHyarBB6jXeXL7s_-WZFN0cp-CDiRKK0JxhysqLIHLdJfkTfAvdoL7PMPp2IJ0XuHEGZpAFV6kMNAJVG321GibWB8ikSPm5kUz8FAiMGtvqODz20mGmYmZLXr7t0nt1pGPF65wf8gNbOeEk1kn5eO9NUh7hKzks-UelhQZZP00G6QgJX4WNJuA4uflm8TLPBjpvZD04N9lwNGRP9OvpW_TNptUjBVKebrf1ZPQLlUGhsNaHqX4qd0VVrIa6yg77ruy6fLfNugoZb3YHlqVtUebVds-ylWQNShuqoRpWos7SLEurLV15VWw3ZVnu2iJPqzxNdxmdl0WKIxNyE4g32vQrU0cN5ISlRSmss_dFOjNFrxBv-MzTHJr6ZaQicRXV1lHqH_nG34M">