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

            Bug ID: 96104
           Summary: internal compiler error: in finish_expr_stmt, at
                    cp/semantics.c:681
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 60rntogo at gmail dot com
  Target Milestone: ---

Created attachment 48843
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48843&action=edit
preprocessed source

I came across the following bug. Sorry, but I really have no idea what is going
on here and I don't know how to describe it or how to tell if this has already
been reported. The problem with the code is obviously that I cast to
std::vector<int> rather than std::vector<int>&, but g++ crashes instead of
reporting this. If I run

g++-10 main.cpp

on

#include <vector>
#include <iterator>
#include <algorithm>

struct B : std::vector<int>
{
  template <typename Range>
  void foo(const Range& range)
  {
    std::copy(range.begin(), range.end(),
std::back_inserter(static_cast<std::vector<int> >(*this) ) );
  }
};

int main()
{
  std::vector<int> a { };
  B b { };
  b.foo(a);
}

I get the error message:

main.cpp: In instantiation of ‘void B::foo(const Range&) [with Range =
std::vector<int>]’:
main.cpp:19:10:   required from here
main.cpp:11:5: internal compiler error: in finish_expr_stmt, at
cp/semantics.c:681
   11 |     std::copy(range.begin(), range.end(),
std::back_inserter(static_cast<std::vector<int> >(*this) ) );
      |     ^~~


g++-10 -v output:

Using built-in specs.
COLLECT_GCC=g++-10
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
10-20200411-0ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-10
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-vtable-verify --enable-plugin
--enable-default-pie --with-system-zlib --enable-libphobos-checking=release
--with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch
--disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none,amdgcn-amdhsa,hsa --without-cuda-driver
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.0.1 20200411 (experimental) [master revision
bb87d5cc77d:75961caccb7:f883c46b4877f637e0fa5025b4d6b5c9040ec566] (Ubuntu
10-20200411-0ubuntu1)

Reply via email to