<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 - cannot control search path order with -stdlib=libc++"
   href="https://bugs.llvm.org/show_bug.cgi?id=49855">49855</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>cannot control search path order with -stdlib=libc++
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>Driver
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>yichen.yan@inf.ethz.ch
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>-stdlib=libc++ will `push_back` to the search path and I met few packages that
will fail due to this.
I understand this should be fixed in the build system of the packages for
misuse `-I`, but do you think a small revision in clang would be helpful?


minimal repro:

root@cc6f61d60963:/test# cat test.cc
#include <cstddef>
root@cc6f61d60963:/test# cat version
user-defined-context
root@cc6f61d60963:/test# /llvm-install/bin/clang++ -stdlib=libc++ -I. -c
test.cc -o /dev/null
In file included from test.cc:1:
In file included from /llvm-install/bin/../include/c++/v1/cstddef:37:
./version:1:1: error: unknown type name 'user'
user-defined-context
^
./version:1:5: error: expected unqualified-id
user-defined-context
    ^
In file included from test.cc:1:
/llvm-install/bin/../include/c++/v1/cstddef:49:9: error: no member named
'ptrdiff_t' in the global namespace
using ::ptrdiff_t;
      ~~^
3 errors generated.
root@cc6f61d60963:/test# /llvm-install/bin/clang++ -nostdinc++
-I/llvm-install/include/c++/v1 -I. -c test.cc -o /dev/null
root@cc6f61d60963:/test# /llvm-install/bin/clang++ -stdlib=libc++ -nostdinc++
-I/llvm-install/include/c++/v1 -I. -c test.cc -o /dev/null
clang-13: warning: argument unused during compilation: '-stdlib=libc++'
[-Wunused-command-line-argument]</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>