Compiling on Fedora release 28 I have the following warning:
0In file included from bench/prevector.cpp:6:
1./prevector.h: In instantiation of ‘void prevector<N, T, Size, Diff>::fill(T*, ptrdiff_t) [with unsigned int N = 28; T = nontrivial_t; Size = unsigned int; Diff = int; ptrdiff_t = long int]’:
2./prevector.h:340:9: required from ‘void prevector<N, T, Size, Diff>::resize(prevector<N, T, Size, Diff>::size_type) [with unsigned int N = 28; T = nontrivial_t; Size = unsigned int; Diff = int; prevector<N, T, Size, Diff>::size_type = unsigned int]’
3bench/prevector.cpp:47:13: required from ‘void PrevectorClear(benchmark::State&) [with T = nontrivial_t]’
4bench/prevector.cpp:102:1: required from here
5./prevector.h:205:21: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct nontrivial_t’; use assignment or value-initialization instead [-Wclass-memaccess]
6 ::memset(dst, 0, count * sizeof(T));
7 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
8bench/prevector.cpp:12:8: note: ‘struct nontrivial_t’ declared here
9 struct nontrivial_t {
10 ^~~~~~~~~~~~
$ gcc –version gcc (GCC) 8.2.1 20181011 (Red Hat 8.2.1-4) Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ ld –version GNU ld version 2.29.1-23.fc28 Copyright (C) 2017 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty.
$ g++ –version g++ (GCC) 8.2.1 20181011 (Red Hat 8.2.1-4) Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Could someone help me to solve this warning.
Thanks