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

    <tr>
        <th>Summary</th>
        <td>
            Passing Constructor Expressions to conditional operator causes data loss while using clang compiler.
        </td>
    </tr>

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

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

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

<pre>
    I use the clang compiler present at my company's common hub to create an AST dump of generated C/C++ code. It works fine for most of my use cases. However, recently, I discovered an edge case where the Clang compiler was not dumping all the information for constructor expressions used with a conditional operator. The code is compiling though. Refer to the below code expression, where a constructor expression MyClass(2, "World") is passed to the false condition of the conditional operator in C++.  In the below expression the information about the constructor passed to the if true condition MyClass(1) is stored properly **BUT** **in the Linux platform**, the constructor data for the if false condition gets lost. I want to see if we are missing something in Linux or should add additional flags for linux. Everything works fine in Windows.
Code Expression in question
**MyClass cObj = ((foo > threshold) ? MyClass(1) : _MyClass(2, "World"))_;**

This is my source cpp file:
[doit.cpp.txt](https://github.com/user-attachments/files/18396637/doit.cpp.txt)

The command used to invoke the clang compiler:
<myClangDir> -fsyntax-only -fno-color-diagnostics -Xclang -ast-dump=json -x c++ -fopenmp "<source>.cpp" -v > ",<myFile>.json"

The Lines highlighted in the below image refer to the data that is being lost on linux for the constructor expressions
![Image](https://github.com/user-attachments/assets/05f40f1d-40b0-4380-ad08-6a7d5aa14ce6)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyclU1v4zgPxz-NciFs2HKdl0MOTdrgKTAPdrHbxextIEu0rRlZ8opyUn_7heR0mhYzc1ighRWbIn_8k6IEke4s4p7VB1Y_rMQUeuf3TS_OYparxql5_wQTIYQeQRphO5BuGLVBD6NHQhtABBjm9FrYmfENxfXgLPRTA8GB9CgCgrBw_-czqGkYwbXQoUUvAio4Mn46Mn5g_AD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