[llvm-bugs] [Bug 33719] New: Libc++ shipped math.h and -isystem breakage

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jul 8 13:18:01 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33719

            Bug ID: 33719
           Summary: Libc++ shipped math.h and -isystem breakage
           Product: libc++
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: krejzi at email.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170708/6b79e8d0/attachment.html>


More information about the llvm-bugs mailing list