Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang crash, when implementing "P2637R3 Member visit" #75819

Closed
H-G-Hristov opened this issue Dec 18, 2023 · 5 comments
Closed

Clang crash, when implementing "P2637R3 Member visit" #75819

H-G-Hristov opened this issue Dec 18, 2023 · 5 comments
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

Comments

@H-G-Hristov
Copy link
Contributor

H-G-Hristov commented Dec 18, 2023

Added the following to libc++ header <visit>:

#  if _LIBCPP_STD_VER >= 26
  // [variant.visit], visitation
  template <class _Self, class _Visitor>
  constexpr decltype(auto) visit(this _Self&& __self, _Visitor&& __visitor) {
    using _V = _OverrideRef<_Self&&, _CopyConst<remove_reference_t<_Self>, variant>>;
    return std::visit(std::forward<_Visitor>(__visitor), (_V)__self);
  }

  template <class _R, class _Self, class _Visitor>
  constexpr _R visit(this _Self&& __self, _Visitor&& __visitor) {
    using _V = _OverrideRef<_Self&&, _CopyConst<remove_reference_t<_Self>, variant>>;
    return std::visit<_R>(std::forward<_Visitor>(__visitor), (_V)__self);
  }
#  endif

Added in libcxx/test/std/utilities/variant/variant.visit/visit.pass.cpp

    obj.visit(v);
    assert(Fn::check_call<int &>(CT_NonConst | CT_LValue));
+ ./build/default.debug.libcxx/bin/llvm-lit --param std=c++26 -sv libcxx/test/std/utilities/variant/variant.visit/visit.pass.cpp
+ tee ./zsh_output/libcxx-test-std-utilities-variant-variant.visit-visit.pass.cpp.c++26.log
llvm-lit: /home/histo/Projects/llvm-project/libcxx/utils/libcxx/test/config.py:20: note: (llvm-libc++-shared.cfg.in) Using %{cxx} substitution: '/usr/bin/clang-18'
llvm-lit: /home//Projects/llvm-project/libcxx/utils/libcxx/test/config.py:20: note: (llvm-libc++-shared.cfg.in) Using %{flags} substitution: '-pthread --target=x86_64-unknown-linux-gnu'
llvm-lit: /home//Projects/llvm-project/libcxx/utils/libcxx/test/config.py:20: note: (llvm-libc++-shared.cfg.in) Using %{compile_flags} substitution: '-nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -Werror=thread-safety -Wuser-defined-warnings'
llvm-lit: /home//Projects/llvm-project/libcxx/utils/libcxx/test/config.py:20: note: (llvm-libc++-shared.cfg.in) Using %{link_flags} substitution: '-lc++experimental -nostdlib++ -L %{lib} -Wl,-rpath,%{lib} -lc++ -latomic'
llvm-lit: /home//Projects/llvm-project/libcxx/utils/libcxx/test/config.py:20: note: (llvm-libc++-shared.cfg.in) Using %{exec} substitution: '%{executor} --execdir %T -- '
llvm-lit: /home//Projects/llvm-project/libcxx/utils/libcxx/test/config.py:20: note: (llvm-libc++-shared.cfg.in) All available features: -faligned-allocation, -fsized-deallocation, add-latomic-workaround, buildhost=linux, c++26, c++experimental, clang, clang-18, clang-18.0, clang-18.0.0, diagnose-if-support, gcc-style-warnings, glibc-old-ru_RU-decimal-point, has-64-bit-atomics, has-fblocks, has-fconstexpr-steps, has-unix-headers, host-has-gdb-with-python, is-lockfree-runtime-function, large_tests, libcpp-abi-version=1, libcpp-hardening-mode=debug, libcpp-has-no-std-modules, linux, locale.en_US.UTF-8, long_tests, non-lockfree-atomics, objective-c++, stdlib=libc++, stdlib=llvm-libc++, target=x86_64-unknown-linux-gnu, thread-safety, verify-support
-- Testing: 1 tests, 1 workers --
Testing: 
FAIL: llvm-libc++-shared.cfg.in :: std/utilities/variant/variant.visit/visit.pass.cpp (1 of 1)
******************** TEST 'llvm-libc++-shared.cfg.in :: std/utilities/variant/variant.visit/visit.pass.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# COMPILED WITH
/usr/bin/clang-18 /home//Projects/llvm-project/libcxx/test/std/utilities/variant/variant.visit/visit.pass.cpp -pthread --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1 -I /home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1 -I /home//Projects/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -Werror=thread-safety -Wuser-defined-warnings  -lc++experimental -nostdlib++ -L /home//Projects/llvm-project/build/default.debug.libcxx/lib -Wl,-rpath,/home//Projects/llvm-project/build/default.debug.libcxx/lib -lc++ -latomic -o /home//Projects/llvm-project/build/default.debug.libcxx/test/std/utilities/variant/variant.visit/Output/visit.pass.cpp.dir/t.tmp.exe
# executed command: /usr/bin/clang-18 /home//Projects/llvm-project/libcxx/test/std/utilities/variant/variant.visit/visit.pass.cpp -pthread --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1 -I /home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1 -I /home//Projects/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -Werror=thread-safety -Wuser-defined-warnings -lc++experimental -nostdlib++ -L /home//Projects/llvm-project/build/default.debug.libcxx/lib -Wl,-rpath,/home//Projects/llvm-project/build/default.debug.libcxx/lib -lc++ -latomic -o /home//Projects/llvm-project/build/default.debug.libcxx/test/std/utilities/variant/variant.visit/Output/visit.pass.cpp.dir/t.tmp.exe
# .---command stderr------------
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
# | Stack dump:
# | 0.	Program arguments: /usr/lib/llvm-18/bin/clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -dumpdir /home//Projects/llvm-project/build/default.debug.libcxx/test/std/utilities/variant/variant.visit/Output/visit.pass.cpp.dir/t.tmp.exe- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name visit.pass.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home//Projects/llvm-project/build/default.debug.libcxx/test/std/utilities/variant/variant.visit -fcoverage-compilation-dir=/home//Projects/llvm-project/build/default.debug.libcxx/test/std/utilities/variant/variant.visit -nostdinc++ -resource-dir /usr/lib/llvm-18/lib/clang/18 -I /home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1 -I /home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1 -I /home//Projects/llvm-project/libcxx/test/support -D _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D _LIBCPP_ENABLE_EXPERIMENTAL -D _LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -internal-isystem /usr/lib/llvm-18/lib/clang/18/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Werror=thread-safety -Wuser-defined-warnings -std=c++26 -fdeprecated-macro -ferror-limit 19 -pthread -fgnuc-version=4.2.1 -fno-implicit-modules -fcxx-exceptions -fexceptions -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/lit-tmp-qujltmwb/visit-d8a4ea.o -x c++ /home//Projects/llvm-project/libcxx/test/std/utilities/variant/variant.visit/visit.pass.cpp
# | 1.	/home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/variant:1505:69: current parser token ';'
# | 2.	/home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/variant:277:1 <Spelling=/home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/__config:825:39>: parsing namespace 'std'
# | 3.	/home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/variant:277:1 <Spelling=/home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/__config:826:39>: parsing namespace 'std::__1'
# | 4.	/home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/variant:1307:1: parsing struct/union/class body 'std::variant'
# | 5.	/home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/variant:1503:77: parsing function body 'std::variant::visit'
# | 6.	/home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/variant:1503:77: in compound statement ('{}')
# |  #0 0x00007f494734ff46 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd4ff46)
# |  #1 0x00007f494734df00 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd4df00)
# |  #2 0x00007f494735060b (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd5060b)
# |  #3 0x00007f4945e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
# |  #4 0x00007f494e9ffdf4 clang::CXXMethodDecl::isExplicitObjectMemberFunction() const (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xdffdf4)
# |  #5 0x00007f494f40ff2d (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x180ff2d)
# |  #6 0x00007f494f40f788 clang::Sema::BuildPossibleImplicitMemberExpr(clang::CXXScopeSpec const&, clang::SourceLocation, clang::LookupResult&, clang::TemplateArgumentListInfo const*, clang::Scope const*, clang::UnresolvedLookupExpr*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x180f788)
# |  #7 0x00007f494f3b4d41 (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x17b4d41)
# |  #8 0x00007f494f3ad6f5 (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x17ad6f5)
# |  #9 0x00007f494f3a685d (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x17a685d)
# | #10 0x00007f494f38c3b4 clang::Sema::CorrectDelayedTyposInExpr(clang::Expr*, clang::VarDecl*, bool, llvm::function_ref<clang::ActionResult<clang::Expr*, true> (clang::Expr*)>) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x178c3b4)
# | #11 0x00007f494f590629 clang::Sema::ActOnReturnStmt(clang::SourceLocation, clang::Expr*, clang::Scope*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x1990629)
# | #12 0x00007f494e812130 clang::Parser::ParseReturnStatement() (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc12130)
# | #13 0x00007f494e80c339 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc0c339)
# | #14 0x00007f494e80b6bb clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc0b6bb)
# | #15 0x00007f494e813f10 clang::Parser::ParseCompoundStatementBody(bool) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc13f10)
# | #16 0x00007f494e814ff2 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc14ff2)
# | #17 0x00007f494e769ee1 clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb69ee1)
# | #18 0x00007f494e768c4a clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb68c4a)
# | #19 0x00007f494e79f51b clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb9f51b)
# | #20 0x00007f494e79cc9e clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb9cc9e)
# | #21 0x00007f494e77eafe clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb7eafe)
# | #22 0x00007f494e81ca74 clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc1ca74)
# | #23 0x00007f494e81bd92 clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc1bd92)
# | #24 0x00007f494e81b73b clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc1b73b)
# | #25 0x00007f494e778eda clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb78eda)
# | #26 0x00007f494e82d4c0 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc2d4c0)
# | #27 0x00007f494e7953bb clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb953bb)
# | #28 0x00007f494e794e00 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb94e00)
# | #29 0x00007f494e779170 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb79170)
# | #30 0x00007f494e82d4c0 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc2d4c0)
# | #31 0x00007f494e7953bb clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb953bb)
# | #32 0x00007f494e794e00 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb94e00)
# | #33 0x00007f494e77909e clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb7909e)
# | #34 0x00007f494e82d4c0 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc2d4c0)
# | #35 0x00007f494e82c03a clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc2c03a)
# | #36 0x00007f494e7653ce clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb653ce)
# | #37 0x00007f4950574165 clang::FrontendAction::Execute() (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x2974165)
# | #38 0x00007f49504ed9e4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x28ed9e4)
# | #39 0x00007f49505ee0be clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x29ee0be)
# | #40 0x000055dce85f6cf5 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-18/bin/clang+0x12cf5)
# | #41 0x000055dce85f4185 (/usr/lib/llvm-18/bin/clang+0x10185)
# | #42 0x000055dce85f3336 clang_main(int, char**, llvm::ToolContext const&) (/usr/lib/llvm-18/bin/clang+0xf336)
# | #43 0x000055dce8600ab2 main (/usr/lib/llvm-18/bin/clang+0x1cab2)
# | #44 0x00007f4945e29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
# | #45 0x00007f4945e29e40 call_init ./csu/../csu/libc-start.c:128:20
# | #46 0x00007f4945e29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
# | #47 0x000055dce85f0bb5 _start (/usr/lib/llvm-18/bin/clang+0xcbb5)
# | clang-18: error: unable to execute command: Segmentation fault (core dumped)
# | clang-18: error: clang frontend command failed due to signal (use -v to see invocation)
# | Ubuntu clang version 18.0.0 (++20231215042254+f4b5be1ecdc8-1~exp1~20231215042405.1371)
# | Target: x86_64-unknown-linux-gnu
# | Thread model: posix
# | InstalledDir: /usr/bin
# | clang-18: note: diagnostic msg: 
# | ********************
# | 
# | PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
# | Preprocessed source(s) and associated run script(s) are located at:
# | clang-18: note: diagnostic msg: /tmp/lit-tmp-qujltmwb/visit-8ecec2.cpp
# | clang-18: note: diagnostic msg: /tmp/lit-tmp-qujltmwb/visit-8ecec2.sh
# | clang-18: note: diagnostic msg: 
# | 
# | ********************
# `-----------------------------
# error: command failed with exit status: 1

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
********************
Failed Tests (1):
  llvm-libc++-shared.cfg.in :: std/utilities/variant/variant.visit/visit.pass.cpp


Testing Time: 3.18s

Total Discovered Tests: 1
  Failed: 1 (100.00%)
@github-actions github-actions bot added the clang Clang issues not falling into any other category label Dec 18, 2023
@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] and removed clang Clang issues not falling into any other category labels Dec 18, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Dec 18, 2023

@llvm/issue-subscribers-clang-frontend

Author: Hristo Hristov (H-G-Hristov)

Added the following to libc++ header `<visit>`:
#  if _LIBCPP_STD_VER &gt;= 26
  // [variant.visit], visitation
  template &lt;class _Self, class _Visitor&gt;
  constexpr decltype(auto) visit(this _Self&amp;&amp; __self, _Visitor&amp;&amp; __visitor) {
    using _V = _OverrideRef&lt;_Self&amp;&amp;, _CopyConst&lt;remove_reference_t&lt;_Self&gt;, variant&gt;&gt;;
    return std::visit(std::forward&lt;_Visitor&gt;(__visitor), (_V)__self);
  }

  template &lt;class _R, class _Self, class _Visitor&gt;
  constexpr _R visit(this _Self&amp;&amp; __self, _Visitor&amp;&amp; __visitor) {
    using _V = _OverrideRef&lt;_Self&amp;&amp;, _CopyConst&lt;remove_reference_t&lt;_Self&gt;, variant&gt;&gt;;
    return std::visit&lt;_R&gt;(std::forward&lt;_Visitor&gt;(__visitor), (_V)__self);
  }
#  endif

Added in libcxx/test/std/utilities/variant/variant.visit/visit.pass.cpp

    obj.visit(v);
    assert(Fn::check_call&lt;int &amp;&gt;(CT_NonConst | CT_LValue));
+ ./build/default.debug.libcxx/bin/llvm-lit --param std=c++26 -sv libcxx/test/std/utilities/variant/variant.visit/visit.pass.cpp
+ tee ./zsh_output/libcxx-test-std-utilities-variant-variant.visit-visit.pass.cpp.c++26.log
llvm-lit: /home/histo/Projects/llvm-project/libcxx/utils/libcxx/test/config.py:20: note: (llvm-libc++-shared.cfg.in) Using %{cxx} substitution: '/usr/bin/clang-18'
llvm-lit: /home//Projects/llvm-project/libcxx/utils/libcxx/test/config.py:20: note: (llvm-libc++-shared.cfg.in) Using %{flags} substitution: '-pthread --target=x86_64-unknown-linux-gnu'
llvm-lit: /home//Projects/llvm-project/libcxx/utils/libcxx/test/config.py:20: note: (llvm-libc++-shared.cfg.in) Using %{compile_flags} substitution: '-nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -Werror=thread-safety -Wuser-defined-warnings'
llvm-lit: /home//Projects/llvm-project/libcxx/utils/libcxx/test/config.py:20: note: (llvm-libc++-shared.cfg.in) Using %{link_flags} substitution: '-lc++experimental -nostdlib++ -L %{lib} -Wl,-rpath,%{lib} -lc++ -latomic'
llvm-lit: /home//Projects/llvm-project/libcxx/utils/libcxx/test/config.py:20: note: (llvm-libc++-shared.cfg.in) Using %{exec} substitution: '%{executor} --execdir %T -- '
llvm-lit: /home//Projects/llvm-project/libcxx/utils/libcxx/test/config.py:20: note: (llvm-libc++-shared.cfg.in) All available features: -faligned-allocation, -fsized-deallocation, add-latomic-workaround, buildhost=linux, c++26, c++experimental, clang, clang-18, clang-18.0, clang-18.0.0, diagnose-if-support, gcc-style-warnings, glibc-old-ru_RU-decimal-point, has-64-bit-atomics, has-fblocks, has-fconstexpr-steps, has-unix-headers, host-has-gdb-with-python, is-lockfree-runtime-function, large_tests, libcpp-abi-version=1, libcpp-hardening-mode=debug, libcpp-has-no-std-modules, linux, locale.en_US.UTF-8, long_tests, non-lockfree-atomics, objective-c++, stdlib=libc++, stdlib=llvm-libc++, target=x86_64-unknown-linux-gnu, thread-safety, verify-support
-- Testing: 1 tests, 1 workers --
Testing: 
FAIL: llvm-libc++-shared.cfg.in :: std/utilities/variant/variant.visit/visit.pass.cpp (1 of 1)
******************** TEST 'llvm-libc++-shared.cfg.in :: std/utilities/variant/variant.visit/visit.pass.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# COMPILED WITH
/usr/bin/clang-18 /home//Projects/llvm-project/libcxx/test/std/utilities/variant/variant.visit/visit.pass.cpp -pthread --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1 -I /home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1 -I /home//Projects/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -Werror=thread-safety -Wuser-defined-warnings  -lc++experimental -nostdlib++ -L /home//Projects/llvm-project/build/default.debug.libcxx/lib -Wl,-rpath,/home//Projects/llvm-project/build/default.debug.libcxx/lib -lc++ -latomic -o /home//Projects/llvm-project/build/default.debug.libcxx/test/std/utilities/variant/variant.visit/Output/visit.pass.cpp.dir/t.tmp.exe
# executed command: /usr/bin/clang-18 /home//Projects/llvm-project/libcxx/test/std/utilities/variant/variant.visit/visit.pass.cpp -pthread --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1 -I /home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1 -I /home//Projects/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -Werror=thread-safety -Wuser-defined-warnings -lc++experimental -nostdlib++ -L /home//Projects/llvm-project/build/default.debug.libcxx/lib -Wl,-rpath,/home//Projects/llvm-project/build/default.debug.libcxx/lib -lc++ -latomic -o /home//Projects/llvm-project/build/default.debug.libcxx/test/std/utilities/variant/variant.visit/Output/visit.pass.cpp.dir/t.tmp.exe
# .---command stderr------------
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
# | Stack dump:
# | 0.	Program arguments: /usr/lib/llvm-18/bin/clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -dumpdir /home//Projects/llvm-project/build/default.debug.libcxx/test/std/utilities/variant/variant.visit/Output/visit.pass.cpp.dir/t.tmp.exe- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name visit.pass.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home//Projects/llvm-project/build/default.debug.libcxx/test/std/utilities/variant/variant.visit -fcoverage-compilation-dir=/home//Projects/llvm-project/build/default.debug.libcxx/test/std/utilities/variant/variant.visit -nostdinc++ -resource-dir /usr/lib/llvm-18/lib/clang/18 -I /home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1 -I /home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1 -I /home//Projects/llvm-project/libcxx/test/support -D _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D _LIBCPP_ENABLE_EXPERIMENTAL -D _LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -internal-isystem /usr/lib/llvm-18/lib/clang/18/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Werror=thread-safety -Wuser-defined-warnings -std=c++26 -fdeprecated-macro -ferror-limit 19 -pthread -fgnuc-version=4.2.1 -fno-implicit-modules -fcxx-exceptions -fexceptions -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/lit-tmp-qujltmwb/visit-d8a4ea.o -x c++ /home//Projects/llvm-project/libcxx/test/std/utilities/variant/variant.visit/visit.pass.cpp
# | 1.	/home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/variant:1505:69: current parser token ';'
# | 2.	/home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/variant:277:1 &lt;Spelling=/home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/__config:825:39&gt;: parsing namespace 'std'
# | 3.	/home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/variant:277:1 &lt;Spelling=/home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/__config:826:39&gt;: parsing namespace 'std::__1'
# | 4.	/home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/variant:1307:1: parsing struct/union/class body 'std::variant'
# | 5.	/home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/variant:1503:77: parsing function body 'std::variant::visit'
# | 6.	/home//Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/variant:1503:77: in compound statement ('{}')
# |  #<!-- -->0 0x00007f494734ff46 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd4ff46)
# |  #<!-- -->1 0x00007f494734df00 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd4df00)
# |  #<!-- -->2 0x00007f494735060b (/usr/lib/llvm-18/bin/../lib/libLLVM-18.so.1+0xd5060b)
# |  #<!-- -->3 0x00007f4945e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
# |  #<!-- -->4 0x00007f494e9ffdf4 clang::CXXMethodDecl::isExplicitObjectMemberFunction() const (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xdffdf4)
# |  #<!-- -->5 0x00007f494f40ff2d (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x180ff2d)
# |  #<!-- -->6 0x00007f494f40f788 clang::Sema::BuildPossibleImplicitMemberExpr(clang::CXXScopeSpec const&amp;, clang::SourceLocation, clang::LookupResult&amp;, clang::TemplateArgumentListInfo const*, clang::Scope const*, clang::UnresolvedLookupExpr*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x180f788)
# |  #<!-- -->7 0x00007f494f3b4d41 (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x17b4d41)
# |  #<!-- -->8 0x00007f494f3ad6f5 (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x17ad6f5)
# |  #<!-- -->9 0x00007f494f3a685d (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x17a685d)
# | #<!-- -->10 0x00007f494f38c3b4 clang::Sema::CorrectDelayedTyposInExpr(clang::Expr*, clang::VarDecl*, bool, llvm::function_ref&lt;clang::ActionResult&lt;clang::Expr*, true&gt; (clang::Expr*)&gt;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x178c3b4)
# | #<!-- -->11 0x00007f494f590629 clang::Sema::ActOnReturnStmt(clang::SourceLocation, clang::Expr*, clang::Scope*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x1990629)
# | #<!-- -->12 0x00007f494e812130 clang::Parser::ParseReturnStatement() (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc12130)
# | #<!-- -->13 0x00007f494e80c339 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc0c339)
# | #<!-- -->14 0x00007f494e80b6bb clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc0b6bb)
# | #<!-- -->15 0x00007f494e813f10 clang::Parser::ParseCompoundStatementBody(bool) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc13f10)
# | #<!-- -->16 0x00007f494e814ff2 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&amp;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc14ff2)
# | #<!-- -->17 0x00007f494e769ee1 clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&amp;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb69ee1)
# | #<!-- -->18 0x00007f494e768c4a clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&amp;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb68c4a)
# | #<!-- -->19 0x00007f494e79f51b clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&amp;, unsigned int, clang::Decl*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb9f51b)
# | #<!-- -->20 0x00007f494e79cc9e clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&amp;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb9cc9e)
# | #<!-- -->21 0x00007f494e77eafe clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb7eafe)
# | #<!-- -->22 0x00007f494e81ca74 clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&amp;, clang::ParsingDeclRAIIObject&amp;, clang::SourceLocation&amp;, clang::ParsedAttributes&amp;, clang::AccessSpecifier) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc1ca74)
# | #<!-- -->23 0x00007f494e81bd92 clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&amp;, clang::ParsedAttributes&amp;, clang::AccessSpecifier) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc1bd92)
# | #<!-- -->24 0x00007f494e81b73b clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&amp;, clang::ParsedAttributes&amp;, clang::AccessSpecifier) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc1b73b)
# | #<!-- -->25 0x00007f494e778eda clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&amp;, clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::SourceLocation*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb78eda)
# | #<!-- -->26 0x00007f494e82d4c0 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc2d4c0)
# | #<!-- -->27 0x00007f494e7953bb clang::Parser::ParseInnerNamespace(llvm::SmallVector&lt;clang::Parser::InnerNamespaceInfo, 4u&gt; const&amp;, unsigned int, clang::SourceLocation&amp;, clang::ParsedAttributes&amp;, clang::BalancedDelimiterTracker&amp;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb953bb)
# | #<!-- -->28 0x00007f494e794e00 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&amp;, clang::SourceLocation) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb94e00)
# | #<!-- -->29 0x00007f494e779170 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&amp;, clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::SourceLocation*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb79170)
# | #<!-- -->30 0x00007f494e82d4c0 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc2d4c0)
# | #<!-- -->31 0x00007f494e7953bb clang::Parser::ParseInnerNamespace(llvm::SmallVector&lt;clang::Parser::InnerNamespaceInfo, 4u&gt; const&amp;, unsigned int, clang::SourceLocation&amp;, clang::ParsedAttributes&amp;, clang::BalancedDelimiterTracker&amp;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb953bb)
# | #<!-- -->32 0x00007f494e794e00 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&amp;, clang::SourceLocation) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb94e00)
# | #<!-- -->33 0x00007f494e77909e clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&amp;, clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::SourceLocation*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb7909e)
# | #<!-- -->34 0x00007f494e82d4c0 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc2d4c0)
# | #<!-- -->35 0x00007f494e82c03a clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&lt;clang::DeclGroupRef&gt;&amp;, clang::Sema::ModuleImportState&amp;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xc2c03a)
# | #<!-- -->36 0x00007f494e7653ce clang::ParseAST(clang::Sema&amp;, bool, bool) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0xb653ce)
# | #<!-- -->37 0x00007f4950574165 clang::FrontendAction::Execute() (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x2974165)
# | #<!-- -->38 0x00007f49504ed9e4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x28ed9e4)
# | #<!-- -->39 0x00007f49505ee0be clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-18/bin/../lib/libclang-cpp.so.18+0x29ee0be)
# | #<!-- -->40 0x000055dce85f6cf5 cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) (/usr/lib/llvm-18/bin/clang+0x12cf5)
# | #<!-- -->41 0x000055dce85f4185 (/usr/lib/llvm-18/bin/clang+0x10185)
# | #<!-- -->42 0x000055dce85f3336 clang_main(int, char**, llvm::ToolContext const&amp;) (/usr/lib/llvm-18/bin/clang+0xf336)
# | #<!-- -->43 0x000055dce8600ab2 main (/usr/lib/llvm-18/bin/clang+0x1cab2)
# | #<!-- -->44 0x00007f4945e29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
# | #<!-- -->45 0x00007f4945e29e40 call_init ./csu/../csu/libc-start.c:128:20
# | #<!-- -->46 0x00007f4945e29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
# | #<!-- -->47 0x000055dce85f0bb5 _start (/usr/lib/llvm-18/bin/clang+0xcbb5)
# | clang-18: error: unable to execute command: Segmentation fault (core dumped)
# | clang-18: error: clang frontend command failed due to signal (use -v to see invocation)
# | Ubuntu clang version 18.0.0 (++20231215042254+f4b5be1ecdc8-1~exp1~20231215042405.1371)
# | Target: x86_64-unknown-linux-gnu
# | Thread model: posix
# | InstalledDir: /usr/bin
# | clang-18: note: diagnostic msg: 
# | ********************
# | 
# | PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
# | Preprocessed source(s) and associated run script(s) are located at:
# | clang-18: note: diagnostic msg: /tmp/lit-tmp-qujltmwb/visit-8ecec2.cpp
# | clang-18: note: diagnostic msg: /tmp/lit-tmp-qujltmwb/visit-8ecec2.sh
# | clang-18: note: diagnostic msg: 
# | 
# | ********************
# `-----------------------------
# error: command failed with exit status: 1

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
********************
Failed Tests (1):
  llvm-libc++-shared.cfg.in :: std/utilities/variant/variant.visit/visit.pass.cpp


Testing Time: 3.18s

Total Discovered Tests: 1
  Failed: 1 (100.00%)

@H-G-Hristov
Copy link
Contributor Author

H-G-Hristov commented Dec 18, 2023

@cor3ntin Could this be a "deducing this" issue, which is the only "unusual" thing?

@cor3ntin
Copy link
Contributor

This looks very similar to #75732

@cor3ntin
Copy link
Contributor

@H-G-Hristov the crash will be fixed by #75913
There seems to be the same function defined twice in your code (also make sure std::visit is defined at the point it is called)

@EugeneZelenko EugeneZelenko added the question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead! label Dec 21, 2023
@H-G-Hristov
Copy link
Contributor Author

It's fixed. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Projects
None yet
Development

No branches or pull requests

4 participants