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

Richard Smith via cfe-dev cfe-dev at lists.llvm.org
Fri Dec 23 00:16:46 PST 2016


On 22 Dec 2016 10:15 pm, "Pavel A. Lebedev via cfe-dev" <
cfe-dev at lists.llvm.org> wrote:

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.


This one seems like a bug in tbb. cstdlib is allowed to declare this
function with a non-throwing exception specification, and if it does, that
conflicts with tbb's declaration.

We could probably make this work too, but generally I don't think it's
reasonable for an implementation of part of the C standard library to
include C standard library headers from a different standard library of
unknown provenance... so in the first instance we should ask Intel to
change tbb.


---
Pavel A. Lebedev

_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161223/a098828f/attachment.html>


More information about the cfe-dev mailing list