https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61451
--- Comment #1 from Eugenio Bargiacchi <svalorzen at gmail dot com> --- For some reason, if an additional line is added, the error goes away. This compiles fine: #include <tuple> template <typename M> struct is_generative_model { private: template <typename Z> static auto test(int) -> decltype( static_cast<size_t (Z::*)() const> (&Z::getS), static_cast<double (Z::*)(size_t,size_t) const> (&Z::sample), static_cast<size_t (Z::*)(size_t,size_t) const> (&Z::sample), std::true_type() ); template <typename Z> static auto test(...) -> std::false_type; public: enum { value = std::is_same<decltype(test<M>(0)),std::true_type>::value }; }; int main() { return 0; }