[cfe-dev] Problem with new C++17 noexcept rules

Pavel A. Lebedev via cfe-dev cfe-dev at lists.llvm.org
Thu Dec 22 22:15:37 PST 2016


On Wed, Nov 30, 2016 3:25 AM, Richard Smith via <mailto:cfe-dev at lists.llvm.org> wrote: 
> Sorry for the delay, that should be fixed in r288220.

I've found a reverse case for this, one where glibc's throw() version tries to redeclare
the previous one given without it. It happens as a side effect of libcxx r288575 adding a
new include and manifests in building Intel TBB. The reduced test case is:

$ cat tbb-fail.cpp

#include <cstddef>
extern "C" void *aligned_alloc(size_t alignment, size_t size);
#include <cstdlib>

$ clang++ -fsyntax-only tbb-fail.cpp
In file included from tbb-fail.cpp:3:
In file included from /usr/bin/../include/c++/v1/cstdlib:86:
In file included from /usr/bin/../include/c++/v1/stdlib.h:94:
/usr/include/stdlib.h:509:14: error: exception specification in declaration does not match previous declaration
extern void *aligned_alloc (size_t __alignment, size_t __size)
             ^
tbb.cpp:3:18: note: previous declaration is here
extern "C" void *aligned_alloc(size_t alignment, size_t size);
                 ^
1 error generated.

This time it happens regardless of language standard used.

The original code in TBB (src/tbbmalloc/proxy.cpp) declares aligned_alloc itself,
AFAIU, for the sake of adding __attribute__ ((alias("memalign"))), and manages
to do it before including any system-provided declaration.

---
Pavel A. Lebedev




More information about the cfe-dev mailing list