<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 - doesn't work std::filesystem::directory_options::follow_directory_symlink"
   href="https://bugs.llvm.org/show_bug.cgi?id=38837">38837</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>doesn't work std::filesystem::directory_options::follow_directory_symlink
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </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>All Bugs
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>#include <iostream>
#include <filesystem>
#include <fstream>

namespace fs = std::filesystem;

int main()
{
  fs::create_directory("dir_a");
  std::ofstream{"dir_a/a.txt"};

  fs::create_directory("dir_b");
  std::ofstream{"dir_b/b.txt"};
  fs::create_directory_symlink("dir_a", "dir_b/dir_a");

  for (const fs::directory_entry& x : fs::recursive_directory_iterator(
                                        "dir_b",
                                       
fs::directory_options::follow_directory_symlink)) {
    std::cout << x.path() << std::endl;
  }
}

expected result:
"dir_b/b.txt"
"dir_b/dir_a"
"dir_b/dir_a/a.txt"

actual result:
"dir_b/b.txt"
"dir_b/dir_a"
terminating with uncaught exception of type
std::__1::__fs::filesystem::filesystem_error: filesystem error: in
recursive_directory_iterator::operator++(): attempting recursion into
"dir_b/dir_a": Too many levels of symbolic links</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>