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

Pavel A. Lebedev via cfe-dev cfe-dev at lists.llvm.org
Fri Nov 4 09:58:01 PDT 2016


On Thu, Nov 3, 2016 2:19 AM, Richard Smith via <cfe-dev at lists.llvm.org> wrote:
> I fixed this in r285779.

Thanks, that fixes the problem I reported, but there's more:

$ cat d2.cpp

#include <xmmintrin.h>

$ clang++ -std=c++1z -fno-exceptions -fsyntax-only d2.cpp

In file included from d.cpp:1:
In file included from /usr/bin/../lib/clang/4.0.0/include/xmmintrin.h:39:
/usr/bin/../lib/clang/4.0.0/include/mm_malloc.h:39:16: error: conflicting types for 'posix_memalign'
extern "C" int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
               ^
/usr/include/stdlib.h:503:12: note: previous declaration is here
extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
           ^
1 error generated.

The second file comes from glibc 2.23. The rest of the declaration
(not shown in the error message above) contains a macro that expands
to throw() when compiled with C++ compiler, whatever that means for
an extern "C" function (which it is due to being inside extern "C" {}
block, also not shown above). The first declaration has no explicit
exception specification. As with the previous case, the error disappears
if one omits -fno-exceptions.

---
Pavel A. Lebedev




More information about the cfe-dev mailing list