https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81182
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- There's something strange about the Debian package then. $ cat np.cc struct S { int i; }; template<typename> struct T { auto operator->() { return &s; } S s; }; template<typename> void problem(T<void>& t) { t->i; } $ ~/gcc/7.1.0/bin/g++ -c -v np.cc Using built-in specs. COLLECT_GCC=/home/jwakely/gcc/7.1.0/bin/g++ Target: x86_64-pc-linux-gnu Configured with: /home/jwakely/src/gcc/gcc-7/configure --prefix=/home/jwakely/gcc/7.1.0 --enable-libstdcxx-debug --disable-bootstrap --disable-liboffloadmic --disable-libmpx --disable-libhsail-rt --without-isl --enable-languages=c,c++ Thread model: posix gcc version 7.1.0 (GCC) COLLECT_GCC_OPTIONS='-c' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /home/jwakely/gcc/7.1.0/libexec/gcc/x86_64-pc-linux-gnu/7.1.0/cc1plus -quiet -v -D_GNU_SOURCE np.cc -quiet -dumpbase np.cc -mtune=generic -march=x86-64 -auxbase np -version -o /tmp/ccp7MnOW.s GNU C++14 (GCC) version 7.1.0 (x86_64-pc-linux-gnu) compiled by GNU C version 6.3.1 20161221 (Red Hat 6.3.1-1), GMP version 6.1.1, MPFR version 3.1.5, MPC version 1.0.2, isl version none GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/home/jwakely/gcc/7.1.0/lib/gcc/x86_64-pc-linux-gnu/7.1.0/../../../../x86_64-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /home/jwakely/gcc/7.1.0/lib/gcc/x86_64-pc-linux-gnu/7.1.0/../../../../include/c++/7.1.0 /home/jwakely/gcc/7.1.0/lib/gcc/x86_64-pc-linux-gnu/7.1.0/../../../../include/c++/7.1.0/x86_64-pc-linux-gnu /home/jwakely/gcc/7.1.0/lib/gcc/x86_64-pc-linux-gnu/7.1.0/../../../../include/c++/7.1.0/backward /home/jwakely/gcc/7.1.0/lib/gcc/x86_64-pc-linux-gnu/7.1.0/include /usr/local/include /home/jwakely/gcc/7.1.0/include /home/jwakely/gcc/7.1.0/lib/gcc/x86_64-pc-linux-gnu/7.1.0/include-fixed /usr/include End of search list. GNU C++14 (GCC) version 7.1.0 (x86_64-pc-linux-gnu) compiled by GNU C version 6.3.1 20161221 (Red Hat 6.3.1-1), GMP version 6.1.1, MPFR version 3.1.5, MPC version 1.0.2, isl version none GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 9c4196dd7cfc6b28dfb404cfbddcbfa6 np.cc: In function ‘void problem(T<void>&)’: np.cc:16:6: error: result of ‘operator->()’ yields non-pointer result t->i; ^~