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

C++17: [Boost-1.83.0] Assertion failure while parsing MemInitializer of a constructor #65568

Closed
kiranktp opened this issue Sep 7, 2023 · 3 comments
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] duplicate Resolved as duplicate needs-reduction Large reproducer that should be reduced into a simpler form

Comments

@kiranktp
Copy link
Contributor

kiranktp commented Sep 7, 2023

Building Boost-1.83.0 Libraries with latest clang compiler fails.

Note: Build of the Boost-1.83.0 Libraries succeeds with cxxstd=14 instead of cxxstd=17.

$ clang++ --version
clang version 18.0.0 (https://github.com/llvm/llvm-project.git c0703ea)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/tpki/compilers/aocc/up2-dbg/bin
$ clang++ repro.cpp -O3 -std=c++20
...
clang-18: /home/tpki/llvm-flang-src/llvm-project1/llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From *) [To = clang::CXXConstructExpr, From = clang::Expr]: Assertion `isa
(Val) && "cast() argument of incompatible type!"' failed.
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: /home/tpki/llvm-flang-src/llvm-project1/install_dbg/bin/clang-18 -cc ....

  1.  repro.cpp:53404:1: current parser token '{'
    
  2.  repro.cpp:53390:1: parsing namespace 'boost'
    
  3.  repro.cpp:53391:1: parsing namespace 'boost::urls'
    

#0 0x00007f7104a65c7d llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/tpki/llvm-flang-src/llvm-project1/llvm/lib/Support/Unix/Signals.inc:723:11
#1 0x00007f7104a6616b PrintStackTraceSignalHandler(void*) /home/tpki/llvm-flang-src/llvm-project1/llvm/lib/Support/Unix/Signals.inc:798:1
#2 0x00007f7104a641d6 llvm::sys::RunSignalHandlers() /home/tpki/llvm-flang-src/llvm-project1/llvm/lib/Support/Signals.cpp:105:5
#3 0x00007f7104a66925 SignalHandler(int) /home/tpki/llvm-flang-src/llvm-project1/llvm/lib/Support/Unix/Signals.inc:413:1
#4 0x00007f7104160520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#5 0x00007f71041b4a7c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#6 0x00007f71041b4a7c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#7 0x00007f71041b4a7c pthread_kill ./nptl/pthread_kill.c:89:10
#8 0x00007f7104160476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
#9 0x00007f71041467f3 abort ./stdlib/abort.c:81:7
#10 0x00007f710414671b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#11 0x00007f7104157e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#12 0x00007f70fd321018 decltype(auto) llvm::cast<clang::CXXConstructExpr, clang::Expr>(clang::Expr*) /home/tpki/llvm-flang-src/llvm-project1/llvm/include/llvm/Support/Casting.h:579:10
#13 0x00007f70fd53db82 clang::Sema::BuildDelegatingInitializer(clang::TypeSourceInfo*, clang::Expr*, clang::CXXRecordDecl*) /home/tpki/llvm-flang-src/llvm-project1/clang/lib/Sema/SemaDeclCXX.
cpp:4720:5
#14 0x00007f70fd53d01c clang::Sema::BuildBaseInitializer(clang::QualType, clang::TypeSourceInfo*, clang::Expr*, clang::CXXRecordDecl*, clang::SourceLocation) /home/tpki/llvm-flang-src/llvm-pr
oject1/clang/lib/Sema/SemaDeclCXX.cpp:4801:14
repro.tar.gz

@kiranktp kiranktp added clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] labels Sep 7, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Sep 7, 2023

@llvm/issue-subscribers-clang-frontend

@cor3ntin cor3ntin added the needs-reduction Large reproducer that should be reduced into a simpler form label Sep 7, 2023
@DimitryAndric
Copy link
Collaborator

Is this yet another duplicate of #39319 ?

@DimitryAndric
Copy link
Collaborator

Indeed, this assertion is also solved by https://reviews.llvm.org/D148474, same as #39319.

@DimitryAndric DimitryAndric closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2023
@EugeneZelenko EugeneZelenko added duplicate Resolved as duplicate and removed new issue labels Sep 7, 2023
shafik added a commit that referenced this issue Dec 8, 2023
…ction if we are going use copy elision

ResolveConstructorOverload needs to check properly if we are going to use copy
elision we can't use a conversion function.

This fixes:

#39319
#60182
#62157
#64885
#65568

Differential Revision: https://reviews.llvm.org/D148474
freebsd-git pushed a commit to freebsd/freebsd-src that referenced this issue Mar 20, 2024
  [Clang] Fix ResolveConstructorOverload to not select a conversion function if we are going use copy elision

  ResolveConstructorOverload needs to check properly if we are going to use copy
  elision we can't use a conversion function.

  This fixes:

  llvm/llvm-project#39319
  llvm/llvm-project#60182
  llvm/llvm-project#62157
  llvm/llvm-project#64885
  llvm/llvm-project#65568

  Differential Revision: https://reviews.llvm.org/D148474

This should fix 'Assertion failed: (isa<To>(Val) && "cast<Ty>() argument
of incompatible type!")' errors when building devel/boost-libs,
specifically libs/url/src/segments_view.cpp.

Bump __FreeBSD_version so this fix can easily be detected from
devel/boost-all/compiled.mk.

PR:		273335
freebsd-git pushed a commit to freebsd/freebsd-src that referenced this issue Mar 23, 2024
  [Clang] Fix ResolveConstructorOverload to not select a conversion function if we are going use copy elision

  ResolveConstructorOverload needs to check properly if we are going to use copy
  elision we can't use a conversion function.

  This fixes:

  llvm/llvm-project#39319
  llvm/llvm-project#60182
  llvm/llvm-project#62157
  llvm/llvm-project#64885
  llvm/llvm-project#65568

  Differential Revision: https://reviews.llvm.org/D148474

This should fix 'Assertion failed: (isa<To>(Val) && "cast<Ty>() argument
of incompatible type!")' errors when building devel/boost-libs,
specifically libs/url/src/segments_view.cpp.

Bump __FreeBSD_version so this fix can easily be detected from
devel/boost-all/compiled.mk.

PR:		273335
(cherry picked from commit bcd401b)
freebsd-git pushed a commit to freebsd/freebsd-src that referenced this issue Mar 23, 2024
  [Clang] Fix ResolveConstructorOverload to not select a conversion function if we are going use copy elision

  ResolveConstructorOverload needs to check properly if we are going to use copy
  elision we can't use a conversion function.

  This fixes:

  llvm/llvm-project#39319
  llvm/llvm-project#60182
  llvm/llvm-project#62157
  llvm/llvm-project#64885
  llvm/llvm-project#65568

  Differential Revision: https://reviews.llvm.org/D148474

This should fix 'Assertion failed: (isa<To>(Val) && "cast<Ty>() argument
of incompatible type!")' errors when building devel/boost-libs,
specifically libs/url/src/segments_view.cpp.

Bump __FreeBSD_version so this fix can easily be detected from
devel/boost-all/compiled.mk.

PR:		273335
(cherry picked from commit bcd401b)
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] duplicate Resolved as duplicate needs-reduction Large reproducer that should be reduced into a simpler form
Projects
None yet
Development

No branches or pull requests

5 participants