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

    <tr>
        <th>Summary</th>
        <td>
            Diagnosis "-Wuninitialized" fails when a variable is passed as a forwarding (universal) reference.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    When an uninitialized variable is passed to a function that takes a forwarding reference `T&&`, the warning message like "variable is not initialized" doesn't appear.

```C++
#include <iostream>

template <typename T>
void show(T &&x) {
 std::cout << std::forward<T>(x) << std::endl;
}

int main() {
 int x;
    show(x); // should emit warning, but doesn't
}
```

If you use `const T&` instead of `T&&`, you will see the warning *-Wuninitialized-const-reference* just fine as follows. 

```
assert.cpp:10:10: warning: variable 'x' is uninitialized when passed as a const reference argument here [-Wuninitialized-const-reference]
   10 |     show(x);
      | ^
1 warning generated.
```

Please see also [Godbolt](https://godbolt.org/z/nM8xdn8Yz).

Is this behavior a bug, or is it intended?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVE2P4jgQ_TXFpQRKbEjCIQcaltUcVtpDS6M9VuKCeMaxke1Ad__6lcM3M9qVrCDs-nhV71VRCHpvmWtYvMFiM6Ehds7XHfnB9fRTTxqnPuvvHVski4PVVkdNRn-xwiN5TY1h1AEPFAIrjA4Jd4Nto3YWY0cRI_3kkG6dP5FX2u7R844925YRiuwdRJFOkYFYY-wYT-RtMus5BNozGv2TEYR4zGddxAcsIAQqx8GCKCPS4cDkZ5BtIFtdvkV2PmsQb-mcb4XUtjWDYgS51i5Ez9SD_OPRNXJ_MBRHk_h5YEs94_vN6Oi0wtC5E4jqHc_FfIBYIpSXLBiiArkCuWrdEFMYkOv75aUxINdjUFGdvV-s2CoD8oq73Dwi1DZiT9qCqJ4Tp4ePmxciXoGmFCDfEMQWxDbdDkYh9zpeu5_IaIZ47-pr5mtDH4F82-GnG3AII7OtsyHi-5lc1DZEJoVu9yvryemkjcHA_CQBEKvp9yfVTceo05uEQKzwxxAi7rRlpIA7Z4w7hRn-lv7z3yRWH2ft4QBylWfXz612ubqLG0T5AaJMonuW_ykNxUX3lBR-rvcubvL7oWcbsWPPCIu3_ytlsbkRlWcI5Rp_pexOJY4WsLjoML81bc-WPUVWs_-g6m_DFHhsOJngErw_nWqciQmGqLoYDyFJb1TI_vw0c34PYvsFYmv_qj6Urf75ArF8mrRvAWOnAzbc0VE7j4TNMMrJ-dREnQY3slWsQG4nqpZqKZc04TovqqoU5XxZTLq6aSUrWeVini3nO1lmomwXXBVtk4s8W6qJrkUmZFZmZZ4tqryYKa5yKXfLSqpiqQTBPOOetJkZc-wT8okOYeC6kKWcTww1bMK49oSwfMLxEYRIW9DXyWfaDPsA88zoEMM9StTRcL3RtLcu6JA20wuxaRvtSJtw1gj9blPSy04EUQ1WH9kHMmmIb6qYTQZv6hc6dOyGZta6HsQ2Abv8TA_e_eA2gtiO5QQQ27HcfwMAAP__AbnNRg">