https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80446

            Bug ID: 80446
           Summary: UNRESOLVED: 18_support/launder/1.cc compilation failed
                    to produce executable
           Product: gcc
           Version: 7.0.1
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

This test fails on FreeBSD and Cygwin, because their libc does:

#ifndef __has_builtin
#define __has_builtin(x)        0
#endif

This breaks our preprocessor checks for trying not to break older versions of
Clang which don't support the builtin:

#ifdef __has_builtin
# if !__has_builtin(__builtin_launder)
// Try not to break non-GNU compilers that don't support the built-in:
#  define _GLIBCXX_NO_BUILTIN_LAUNDER 1
# endif
#endif

#ifndef _GLIBCXX_NO_BUILTIN_LAUNDER
namespace std
{
#define __cpp_lib_launder 201606


Because those libc headers define __has_builtin we determine that GCC doesn't
support the builtin.

The same problem exists for std::is_aggregate (but the test doesn't fail,
because it doesn't include a libc header before <type_traits>).

We'd have the same problem if users defined __has_builtin before including our
headers.

Maybe we should just remove the attempt to support older Clang releases, or do:

#if __GNUC__ >= 7
# define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1
#elif defined __has_builtin
# if __has_builtin(__builtin_launder)
#  define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1
# endif
#endif

Reply via email to