https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78931
Bug ID: 78931 Summary: ICE on C++17 structured bindings from struct with reference member Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gccbugbjorn at fahller dot se Target Milestone: --- Created attachment 40413 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40413&action=edit preprocessed t.cpp GCC 7 snapshot build from svn rev 243933 produces this output for the attached program: bjorn@pteranodon /tmp $ LANG=C /opt/gcc-trunk/bin/g++ -std=c++1z t.cpp -v -save-temps Using built-in specs. COLLECT_GCC=/opt/gcc-trunk/bin/g++ COLLECT_LTO_WRAPPER=/opt/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../src/gcc-trunk/configure --prefix=/opt/gcc-trunk --with-languages=c,cpp : (reconfigured) ../src/gcc-trunk/configure --prefix=/opt/gcc-trunk --with-languages=c,cpp : (reconfigured) ../src/gcc-trunk/configure --prefix=/opt/gcc-trunk --with-languages=c,cpp --enable-languages=c,c++,fortran,lto,objc --no-create --no-recursion : (reconfigured) ../src/gcc-trunk/configure --prefix=/opt/gcc-trunk --with-languages=c,cpp --enable-languages=c,c++,fortran,lto,objc --no-create --no-recursion : (reconfigured) ../src/gcc-trunk/configure --prefix=/opt/gcc-trunk --with-languages=c,cpp --enable-languages=c,c++,fortran,lto,objc --no-create --no-recursion : (reconfigured) ../src/gcc-trunk/configure --prefix=/opt/gcc-trunk --with-languages=c,cpp --enable-languages=c,c++,fortran,lto,objc --no-create --no-recursion Thread model: posix gcc version 7.0.0 20161227 (experimental) (GCC) COLLECT_GCC_OPTIONS='-std=c++1z' '-v' '-save-temps' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /opt/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/cc1plus -E -quiet -v -D_GNU_SOURCE t.cpp -mtune=generic -march=x86-64 -std=c++1z -fpch-preprocess -o t.ii ignoring nonexistent directory "/opt/gcc-trunk/lib/gcc/x86_64-pc-linux-gnu/7.0.0/../../../../x86_64-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /opt/gcc-trunk/lib/gcc/x86_64-pc-linux-gnu/7.0.0/../../../../include/c++/7.0.0 /opt/gcc-trunk/lib/gcc/x86_64-pc-linux-gnu/7.0.0/../../../../include/c++/7.0.0/x86_64-pc-linux-gnu /opt/gcc-trunk/lib/gcc/x86_64-pc-linux-gnu/7.0.0/../../../../include/c++/7.0.0/backward /opt/gcc-trunk/lib/gcc/x86_64-pc-linux-gnu/7.0.0/include /usr/local/include /opt/gcc-trunk/include /opt/gcc-trunk/lib/gcc/x86_64-pc-linux-gnu/7.0.0/include-fixed /usr/include End of search list. COLLECT_GCC_OPTIONS='-std=c++1z' '-v' '-save-temps' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /opt/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/cc1plus -fpreprocessed t.ii -quiet -dumpbase t.cpp -mtune=generic -march=x86-64 -auxbase t -std=c++1z -version -o t.s GNU C++14 (GCC) version 7.0.0 20161227 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 7.0.0 20161227 (experimental), GMP version 6.1.0, MPFR version 3.1.3-p4, MPC version 1.0.2, isl version 0.15 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU C++14 (GCC) version 7.0.0 20161227 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 7.0.0 20161227 (experimental), GMP version 6.1.0, MPFR version 3.1.3-p4, MPC version 1.0.2, isl version 0.15 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: d72b3d35df92f054e2182b3bf4b43893 t.cpp: In function 'int main()': t.cpp:2:5: error: invalid first operand of MEM_REF int main() ^~~~ _2 t.cpp:10:10: note: in statement return p; ^ D.2090 = MEM[(int &)_2]; t.cpp:2:5: internal compiler error: verify_gimple failed int main() ^~~~ 0xdafdef verify_gimple_in_cfg(function*, bool) ../../src/gcc-trunk/gcc/tree-cfg.c:5266 0xc93046 execute_function_todo ../../src/gcc-trunk/gcc/passes.c:1965 0xc940eb execute_todo ../../src/gcc-trunk/gcc/passes.c:2015 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. Changing the struct to use a value member instead of a reference works fine.