https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88564
Bug ID: 88564 Summary: expected primary-expression error with operator=<X> invocation Product: gcc Version: 8.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jdtournier at gmail dot com Target Milestone: --- I'm encountering compile failures in my project using later builds of gcc 8.2.1 on MSYS2 MinGW64 (running on Windows 10). I originally reported this here: https://stackoverflow.com/q/53842888/3244166. I've stripped this back to a very minimal code example below that triggers the error: test.cpp: --------- template <typename X> class Test { public: template<typename Y> X& operator=(const Y& other) { return *this; } X& operator=(const X& other) { return operator=<X>(other); } }; int main () { return 0; } ------- Compiling with: $ g++ test.cpp -o test results in error: test.cpp: In member function 'X& Test<X>::operator=(const X&)': test.cpp:12:25: error: expected primary-expression before '>' token return operator=<X>(other); ^ When I compile with the previous g++ 8.2.1 snapshot available (20181123), the example compiles fine with no errors. The error only occurs with g++ 8.2.1 snapshot 20181130 (and also 20181207) as provided by the MSYS2 project (detailed specs below). Thank you! Donald. Problematic version of g++: $ g++ -v Using built-in specs. COLLECT_GCC=C:\Users\donald\msys64\mingw64\bin\g++.exe COLLECT_LTO_WRAPPER=C:/Users/donald/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.1/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../gcc-8-20181130/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=ada,c,lto,c++,objc,obj-c++,fortran --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev1, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld Thread model: posix gcc version 8.2.1 20181130 (Rev1, Built by MSYS2 project) Version of g++ that does NOT trigger the error: $ g++ -v Using built-in specs. COLLECT_GCC=C:\Users\donald\msys64\mingw64\bin\g++.exe COLLECT_LTO_WRAPPER=C:/Users/donald/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.1/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../gcc-8-20181123/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=ada,c,lto,c++,objc,obj-c++,fortran --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev1, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld Thread model: posix gcc version 8.2.1 20181123 (Rev1, Built by MSYS2 project)