<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 - Libc++ shipped math.h and -isystem breakage"
   href="https://bugs.llvm.org/show_bug.cgi?id=33719">33719</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Libc++ shipped math.h and -isystem breakage
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>4.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </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>krejzi@email.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>While compiling Qt 5.9.1, which for some reason uses -isystem /usr/include on
my Linux system, I have noticed the following issue:

clang++ will prepend /usr/include before all system search paths, including
/usr/include/c++/v1, where c++ headers and shipped math.h are located, which
means it will pick math.h from /usr/include (from GNU Glibc) if something
includes cmath (which pulls math.h).

This can be tested using the following example

test.cpp:
#include <cmath>

int main()
{
  return (int) isfinite(1);
}

$ clang++ -std=libc++ -std=c++11 test.cpp # all good
$ clang++ -std=libc++ -std=c++11 test.cpp -isystem /usr/include # all hell
breaks loose

/usr/bin/../include/c++/v1/cmath:313:9: error: no member named 'signbit' in the
global namespace; did you mean '__signbit'?
using ::signbit;
      ~~^
/usr/include/bits/mathcalls.h:375:20: note: '__signbit' declared here
__MATHDECL_1 (int, __signbit,, (_Mdouble_ __value))
                   ^
In file included from test.cpp:1:
/usr/bin/../include/c++/v1/cmath:314:9: error: no member named 'fpclassify' in
the global namespace; did you mean '__fpclassify'?
using ::fpclassify;
      ~~^
/usr/include/bits/mathcalls.h:371:20: note: '__fpclassify' declared here
__MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value))
                   ^

and so on...

Linux x86_64, clang 4.0.1 built with libc++ as the default standard library</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>