https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97399
Bug ID: 97399 Summary: g++ 9.3 cannot compile SFINAE code with separated declaration and definition, g++ 7.3 compiles Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: renlin at gcc dot gnu.org Target Milestone: --- Created attachment 49362 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49362&action=edit test case 1 For gcc_1.c++ gcc 7.3 compiles for this code clang 7 compiles for this code gcc 9.3 fails to compile with following message Not sure if this is gcc's issue or clang. ``` <source>:29:16: error: no declaration matches 'constexpr enable_if_t<((tmp*)this)->is_integral<E>(), bool> tmp::func(E, E) const' 29 | constexpr auto tmp::func(E f_lhs, E f_rhs) | ^~~ <source>:18:27: note: candidate is: 'template<class E> static constexpr enable_if_t<((tmp*)this)->is_integral<E>(), bool> tmp::func(E, E)' 18 | static constexpr auto func(E f_lhs, E f_rhs) | ^~~~ <source>:12:8: note: 'struct tmp' defined here 12 | struct tmp ``` Meanwhile for gcc_2.c++ gcc compiles without any issue. clang gives the following error message ``` <source>:27:28: error: template parameter redefines default argument template <class E, class = enable_if_t<tmp::is_integral<E>(), bool>> ^ <source>:17:32: note: previous default template argument defined here template <class E, class = enable_if_t<tmp::is_integral<E>(), bool>> ``` It seems this is not an new issue, and might be duplicated.