[llvm-bugs] [Bug 45405] New: __sigsetjmp declared twice only with libstdc++

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 2 18:06:41 PDT 2020


            Bug ID: 45405
           Summary: __sigsetjmp declared twice only with libstdc++
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: djdjhildreth at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

The actual third-party library I was using that caused the bug was more
complicated, but this is a minimal program that will replicate the issue:

#include <string>
namespace {
#include <setjmp.h>

int main(int argc, char* argv[]) {
    return 0; 

As you can see below, this program fails to compile when using clang and the
default libstdc++. If you specify libc++ it will compile. g++ compiles fine
(with libstdc++, as that's all it uses), however.


$ clang++ --version
clang version 9.0.0 (tags/RELEASE_900/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin

$ clang++ test.cpp -stdlib=libstdc++
In file included from test.cpp:3:
/usr/include/setjmp.h:54:12: error: conflicting types for '__sigsetjmp'
extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask)
/usr/include/pthread.h:744:12: note: previous declaration is here
extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;
1 error generated.

$ clang++ test.cpp -stdlib=libc++
$ g++ --version
g++ (Ubuntu 8.3.0-26ubuntu1~18.04) 8.3.0

$ g++ test.cpp


Note: I ran this on WSL (Ubuntu 18.04) on Windows 10.

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/20200403/f7342369/attachment-0001.html>

More information about the llvm-bugs mailing list