<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [clang-format] Sorting duplicated includes produces invalid code"
   href="https://bugs.llvm.org/show_bug.cgi?id=47634">47634</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[clang-format] Sorting duplicated includes produces invalid code
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Formatter
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>curdeius@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When trying to test <a class="bz_bug_link 
          bz_status_CONFIRMED "
   title="CONFIRMED - Clang-format does not de-duplicate indented #includes"
   href="show_bug.cgi?id=46555">bug #46555</a>, I've tested this code:

```
#include <array>
#include <array>
#include <vector>
#include <vector>

```

with .clang-format being just:
```
SortIncludes: true
```

Clang-format produces invalid code:
```
#include <array>
#include <#include <vector>
```

It happens only though when invoked from VSCode extension (which probably
passes offsets). I'll update the report when I get the full command line.

All versions from at least 7.1.0 until at least post-11.0.0 trunk from
2020-09-22 (clang-format version 12.0.0 (<a href="mailto:git@github.com">git@github.com</a>:llvm/llvm-project.git
7bc3c860a75fc69e0eea0d3ea8233b363304de9a)) are affected.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>