https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92519
Bug ID: 92519
Summary: Spurious "note: ... has no user-provided default
constructor"
Product: gcc
Version: 9.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: patrick at motec dot com.au
Target Milestone: ---
When built with -std=c++17 the following example emits a spurious note.
Changing the lambda argument from 'auto' to 'int' no longer emits the note.
#include <array>
void foo()
{
[](auto v) {
std::array<int, 3> bar;
}(42);
}
% g++ -c -std=c++17 test.cpp
In file included from warning.cpp:1:
warning.cpp: In instantiation of ‘foo()::<lambda(auto:1)> [with auto:1 = int]’:
warning.cpp:7:6: required from here
/usr/include/c++/9.2.0/array:94:12: note: ‘struct std::array<int, 3>’ has no
user-provided default constructor
94 | struct array
| ^~~~~
/usr/include/c++/9.2.0/array:110:56: note: and the implicitly-defined
constructor does not initialize ‘int std::array<int, 3>::_M_elems [3]’
110 | typename _AT_Type::_Type _M_elems;
| ^~~~~~~~
% g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --enable-shared
--enable-threads=posix --with-system-zlib --with-isl --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--disable-libssp --enable-gnu-unique-object --enable-linker-build-id
--enable-lto --enable-plugin --enable-install-libiberty
--with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib
--disable-werror --enable-checking=release --enable-default-pie
--enable-default-ssp --enable-cet=auto gdc_include_dir=/usr/include/dlang/gdc
Thread model: posix
gcc version 9.2.0 (GCC)