[libcxx-commits] [PATCH] D140911: [libc++] Implement P2505R5(Monadic operations for std::expected)

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jan 8 07:46:18 PST 2023


philnik added inline comments.


================
Comment at: libcxx/include/__expected/expected.h:641
+        __expected::__is_expected<_Up>::value, "result of f(value()) must be a specialization of std::expected");
+    static_assert(is_same_v<typename _Up::error_type, _Err>,
+                  "std::remove_cvref_t<decltype(f(value()))>>::error_type must same as error_type");
----------------
yronglin wrote:
> philnik wrote:
> > yronglin wrote:
> > > philnik wrote:
> > > > This `typename` shouldn't be required anymore. Is it to support older Clang versions?
> > > ```
> > > /Users/yrong/Developer/Toolchain/llvm/trunk/rel/include/c++/v1/__expected/expected.h:1267:29: error: template argument for template type parameter must be a type; did you forget 'typename'?
> > >     static_assert(is_same_v<_Up::error_type, _Err>, "The result of f() must have the same error_type as this expected");
> > >                             ^
> > >                             typename 
> > > 
> > > ```
> > > I have encountered a compilation error, when execute `ninja check-cxx`, the failure test is `llvm-project/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp`
> > Which clang version are you using?
> Seems test use trunk compiler, and my host compiler is:
> ```
> ➜  rel clang -v
> Apple clang version 14.0.0 (clang-1400.0.29.202)
> Target: arm64-apple-darwin21.6.0
> Thread model: posix
> InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
> ```
> 
> ```
> /Users/yrong/Developer/Toolchain/llvm/trunk/rel/./bin/clang++ /Users/yrong/Developer/Toolchain/llvm/trunk/llvm-project/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk --target=arm64-apple-darwin21.6.0 -nostdinc++ -I /Users/yrong/Developer/Toolchain/llvm/trunk/rel/include/c++/v1 -I /Users/yrong/Developer/Toolchain/llvm/trunk/rel/include/c++/v1 -I /Users/yrong/Developer/Toolchain/llvm/trunk/llvm-project/libcxx/test/support -std=c++2b -Werror -Wall -Wctad-maybe-unsupported -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_EXPERIMENTAL -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings  -lc++experimental -nostdlib++ -L /Users/yrong/Developer/Toolchain/llvm/trunk/rel/./lib -Wl,-rpath,/Users/yrong/Developer/Toolchain/llvm/trunk/rel/./lib -lc++ -pthread -o /Users/yrong/Developer/Toolchain/llvm/trunk/rel/runtimes/runtimes-bins/test/libcxx/assertions/Output/headers_declare_verbose_abort.sh.cpp.dir/t.tmp.exe -DTEST_46
> ```
> 
> Maybe I can remove typename and try to run CI
Don't bother. According to https://en.cppreference.com/w/cpp/20 it's not in AppleClang and has only been added in Clang 16.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140911



More information about the libcxx-commits mailing list