[libcxx-commits] [PATCH] D114786: [libc++] Remove the ability to use the std::nullptr_t emulation in C++03 mode

Ryan Prichard via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 8 17:53:24 PDT 2022


rprichard added a comment.

I'm seeing the libcxxabi/test/catch_reference_nullptr.pass.cpp test fail on Android, because the test defines a `nullptr_t` in `main()` that shadows `::nullptr_t`, and that test gets compiled with `-Werror -Wshadow`. I think I can rename its `nullptr_t` to `my_nullptr_t` to avoid the collision. I would think the test passes on other targets, so maybe there's some subtle difference that I'm hitting.

  ******************** TEST 'llvm-libc++abi-android.cfg.in :: catch_reference_nullptr.pass.cpp' FAILED ********************
  Script:
  --
  : 'COMPILED WITH';  /x/ndk/out/android-ndk-r26-canary/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ /x/llvm-upstream/llvm-project/libcxxabi/test/catch_reference_nullptr.pass.cpp  --target=aarch64-none-linux-android32 -nostdinc++ -I /x/llvm-upstream/llvm-project/libcxxabi/include -I /x/llvm-upstream/libcxx-arm64-platform/include/c++/v1 -I /x/llvm-upstream/libcxx-arm64-platform/include/aarch64-none-linux-android32/c++/v1  -I /x/llvm-upstream/llvm-project/libcxxabi/../libcxx/test/support -I /x/llvm-upstream/llvm-project/libcxxabi/../libcxx/src -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS -std=c++2b -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-noexcept-type -Wno-atomic-alignment -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_ASSERTIONS=1 -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings  -nostdlib++ -L /x/llvm-upstream/libcxx-arm64-platform/lib -Wl,-rpath,/data/local/tmp/libc++ -lc++ -lc++abi -o /x/llvm-upstream/libcxx-arm64-platform/Output/catch_reference_nullptr.pass.cpp.dir/t.tmp.exe
  : 'EXECUTED AS';  /x/llvm-upstream/job-limiter-child.sh /x/llvm-upstream/limit.970840 /x/llvm-upstream/llvm-project/libcxx/utils/adb_run.py --env PATH=/data/local/tmp/toybox:/product/bin:/apex/com.android.runtime/bin:/apex/com.android.art/bin:/system_ext/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin --execdir /x/llvm-upstream/libcxx-arm64-platform/Output/catch_reference_nullptr.pass.cpp.dir --  /x/llvm-upstream/libcxx-arm64-platform/Output/catch_reference_nullptr.pass.cpp.dir/t.tmp.exe
  --
  Exit Code: 1
  
  Command Output (stdout):
  --
  $ ":" "COMPILED WITH"
  $ "/x/ndk/out/android-ndk-r26-canary/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++" "/x/llvm-upstream/llvm-project/libcxxabi/test/catch_reference_nullptr.pass.cpp" "--target=aarch64-none-linux-android32" "-nostdinc++" "-I" "/x/llvm-upstream/llvm-project/libcxxabi/include" "-I" "/x/llvm-upstream/libcxx-arm64-platform/include/c++/v1" "-I" "/x/llvm-upstream/libcxx-arm64-platform/include/aarch64-none-linux-android32/c++/v1" "-I" "/x/llvm-upstream/llvm-project/libcxxabi/../libcxx/test/support" "-I" "/x/llvm-upstream/llvm-project/libcxxabi/../libcxx/src" "-D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS" "-std=c++2b" "-Werror" "-Wall" "-Wextra" "-Wshadow" "-Wundef" "-Wno-unused-command-line-argument" "-Wno-attributes" "-Wno-pessimizing-move" "-Wno-c++11-extensions" "-Wno-noexcept-type" "-Wno-atomic-alignment" "-Wno-user-defined-literals" "-Wno-tautological-compare" "-Wsign-compare" "-Wunused-variable" "-Wunused-parameter" "-Wunreachable-code" "-Wno-unused-local-typedef" "-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER" "-D_LIBCPP_ENABLE_ASSERTIONS=1" "-D_LIBCPP_DISABLE_AVAILABILITY" "-fcoroutines-ts" "-Werror=thread-safety" "-Wuser-defined-warnings" "-nostdlib++" "-L" "/x/llvm-upstream/libcxx-arm64-platform/lib" "-Wl,-rpath,/data/local/tmp/libc++" "-lc++" "-lc++abi" "-o" "/x/llvm-upstream/libcxx-arm64-platform/Output/catch_reference_nullptr.pass.cpp.dir/t.tmp.exe"
  # command stderr:
  /x/llvm-upstream/llvm-project/libcxxabi/test/catch_reference_nullptr.pass.cpp:30:9: error: declaration shadows a typedef in the global namespace [-Werror,-Wshadow]
    using nullptr_t = decltype(nullptr);
          ^
  /x/llvm-upstream/libcxx-arm64-platform/include/c++/v1/stddef.h:48:31: note: previous declaration is here
      typedef decltype(nullptr) nullptr_t;
                                ^
  1 error generated.
  
  error: command failed with exit status: 1
  
  --


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114786/new/

https://reviews.llvm.org/D114786



More information about the libcxx-commits mailing list