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

--- Comment #1 from Freddie Chopin <freddie_chopin at op dot pl> ---
Created attachment 41276
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41276&action=edit
preprocessed source which causes the problem - minimal version

OK, I've managed to narrow it down to a much smaller test case:

-- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 --

$ cat ice.cpp 
#include <memory>

using Storage = std::aligned_storage<sizeof(int)>::type;
using StorageUniquePointer = std::unique_ptr<Storage[]>;
StorageUniquePointer storageUniquePointer_ {new Storage[1]};

$ arm-none-eabi-g++ -c ice.cpp 
In file included from
/home/freddie/bleeding-edge-toolchain/arm-none-eabi-gcc-7.0.1-RC-20170425-170426/arm-none-eabi-gcc-7.0.1-RC-20170425-170426/arm-none-eabi/include/c++/7.0.1/memory:80:0,
                 from ice.cpp:1:
/home/freddie/bleeding-edge-toolchain/arm-none-eabi-gcc-7.0.1-RC-20170425-170426/arm-none-eabi-gcc-7.0.1-RC-20170425-170426/arm-none-eabi/include/c++/7.0.1/bits/unique_ptr.h:
In instantiation of 'class std::unique_ptr<std::aligned_storage<4>::type [],
std::default_delete<std::aligned_storage<4>::type []> >':
/home/freddie/bleeding-edge-toolchain/arm-none-eabi-gcc-7.0.1-RC-20170425-170426/arm-none-eabi-gcc-7.0.1-RC-20170425-170426/arm-none-eabi/include/c++/7.0.1/bits/unique_ptr.h:470:2:
  required from 'std::unique_ptr<_Tp [], _Dp>::unique_ptr(_Up) [with _Up =
std::aligned_storage<4>::type*; _Vp =
std::default_delete<std::aligned_storage<4>::type []>; <template-parameter-2-3>
= void; <template-parameter-2-4> = bool; _Tp = std::aligned_storage<4>::type;
_Dp = std::default_delete<std::aligned_storage<4>::type []>]'
ice.cpp:5:59:   required from here
/home/freddie/bleeding-edge-toolchain/arm-none-eabi-gcc-7.0.1-RC-20170425-170426/arm-none-eabi-gcc-7.0.1-RC-20170425-170426/arm-none-eabi/include/c++/7.0.1/bits/unique_ptr.h:398:5:
internal compiler error: in finish_member_declaration, at cp/semantics.c:2963
     {
     ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
$

-- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 --

I'm attaching preprocessed source again.

The problem goes away in these situations:
- not using array as the type of std::unique_ptr;
- using anything "simple" as the "Storage" type (for example just an "int")
instead of std::aligned_storage;
- not initializing the object or initializing it with nullptr;

Reply via email to