https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83689
Bug ID: 83689
Summary: Internal compiler error using
is_trivially_default_constructible on array of
nontrivially-destructible types
Product: gcc
Version: 7.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: zhangxy at google dot com
Target Milestone: ---
The following code triggers internal compiler error (see
https://godbolt.org/g/dXRbdK for more details and comparison with clang):
/opt/compiler-explorer/gcc-7.2.0/include/c++/7.2.0/type_traits: In
instantiation of 'struct std::is_trivially_constructible<NontrivialDefaultCtor
[10]>':
/opt/compiler-explorer/gcc-7.2.0/include/c++/7.2.0/type_traits:1373:12:
required from 'struct
std::is_trivially_default_constructible<NontrivialDefaultCtor [10]>'
31 : <source>:31:84: required from here
/opt/compiler-explorer/gcc-7.2.0/include/c++/7.2.0/type_traits:1366:12:
internal compiler error: in build_value_init_noctor, at cp/init.c:483
struct is_trivially_constructible
^~~~~~~~~~~~~~~~~~~~~~~~~~
mmap: Invalid argument
```
#include <type_traits>
class NontrivialDefaultCtor {
public:
NontrivialDefaultCtor() {}
};
void f() {
using NontrivialDefaultCtor10 = NontrivialDefaultCtor[10];
static_assert(!std::is_trivially_default_constructible<NontrivialDefaultCtor10>::value,
"This should be false");
}
```