http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58046
Bug ID: 58046 Summary: template operator= in SFINAE class Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: suibaka at gmail dot com I think the following code should be compile error, but the result is ICE in gcc-4.7.2. The error still exists in gcc HEAD. $ gcc -v Using built-in specs. COLLECT_GCC=C:\MinGW\bin\gcc.exe COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.7.2/lto-wrapper.exe Target: mingw32 Configured with: ../gcc-4.7.2/configure --enable-languages=c,c++,ada,fortran,obj c,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgo mp --disable-win32-registry --enable-libstdcxx-debug --disable-build-poststage1- with-cxx --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw Thread model: win32 gcc version 4.7.2 (GCC) The code: #include <type_traits> extern void* enabler; template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type*& = enabler> class A { public: A() {} template <typename U> A& operator=( A<U>&& rhs ) { return *this; } }; int main() { A<int> a_i; A<double> a_d; a_i = a_d; } The error(in 4.7.2): $ g++ main.cc -Wall -std=c++11 main.cc: In function 'int main()': main.cc:24:11: internal compiler error: in unify, at cp/pt.c:16956 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. The error(in HEAD): prog.cc: In substitution of 'template<class U> A<T, <anonymous> >& A<T, <anonymous> >::operator=(A<U>&&) [with U = <missing>]': prog.cc:24:9: required from here prog.cc:24:9: internal compiler error: in unify, at cp/pt.c:17384 a_i = a_d;