https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86930
Bug ID: 86930 Summary: g++ incorrectly complains about incomplete type in structured binding Product: gcc Version: 8.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: janniksilvanus at gmail dot com Target Milestone: --- : g++ --version g++ (SUSE Linux) 8.1.1 20180719 [gcc-8-branch revision 262874] 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. : cat incomplete_type.ii template <typename Index> struct IndexPair { Index first; Index second; }; using UsedIndexPair = IndexPair<int>; template <typename Applier> void call_applier( UsedIndexPair const & indices, Applier && applier) { auto const [a, b] = indices; applier(a, b); } void instantiate() { call_applier( {0, 1}, [&](int, int){}); } : g++ --std=c++1z incomplete_type.ii -c incomplete_type.ii: In function ‘void call_applier(const UsedIndexPair&, Applier&&)’: incomplete_type.ii:14:15: warning: structured binding refers to incomplete class type ‘const IndexPair<int>’ auto const [a, b] = indices; gcc-7.3.1 even crashes on this input: /opt/rh/devtoolset-7/root/usr/bin/g++ --std=c++1z incomplete_type.ii -c incomplete_type.ii: In function ‘void call_applier(const UsedIndexPair&, Applier&&)’: incomplete_type.ii:14:24: internal compiler error: Segmentation fault auto const [a, b] = indices; ^~~~~~~