[Bug c++/105584] New: libcxx needs using_if_exist attribute

unlvsur at live dot com gcc-bugzilla@gcc.gnu.org
Thu May 12 16:49:36 GMT 2022


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

            Bug ID: 105584
           Summary: libcxx needs using_if_exist attribute
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: unlvsur at live dot com
  Target Milestone: ---

https://github.com/llvm/llvm-project/blob/14e83ada16b3944a4431617ed4ce7088f7f7cd9a/libcxx/include/__config#L772

#if __has_attribute(using_if_exists)
# define _LIBCPP_USING_IF_EXISTS __attribute__((using_if_exists))
#else
# define _LIBCPP_USING_IF_EXISTS
#endif

libcxx recently switches a lot of C usings with the new using_if_exists
attribute in clang, but GCC does not support it, causing compilation to fail if
these global definitions do not exist.

/home/cqwrteur/toolchains/native/x86_64-w64-mingw32/x86_64-w64-mingw32/include/c++/v1/cstdlib:139:9:
error: 'aligned_alloc' has not been declared in '::'
  139 | using ::aligned_alloc _LIBCPP_USING_IF_EXISTS;
      |         ^~~~~~~~~~~~~
/home/cqwrteur/toolchains/native/x86_64-w64-mingw32/x86_64-w64-mingw32/include/c++/v1/ctime:75:9:
error: 'timespec_get' has not been declared in '::'
   75 | using ::timespec_get _LIBCPP_USING_IF_EXISTS;
      |         ^~~~~~~~~~~~
I think GCC should add this attribute to support libcxx correctly.


More information about the Gcc-bugs mailing list