// PR c++/101460 // { dg-do compile { target c++11 } } template struct enable_if { }; template<> struct enable_if { using type = void; }; template using enable_if_t = typename enable_if::type; struct tuple { }; struct pair { }; template enable_if_t get(tuple&) { } // { dg-bogus "candidate" } template enable_if_t get(const tuple&) { } // { dg-bogus "candidate" } template enable_if_t get(pair&) { } // { dg-bogus "candidate" } template enable_if_t get(const pair&) { } // { dg-bogus "candidate" } template constexpr unsigned frob() { static_assert(N == 1, "user-friendly diagnostic"); // { dg-error "user-friendly" } // { dg-message "-1 == 1" "" { target *-*-* } .-1 } // narrowing check, reject negative values return unsigned{N}; // { dg-prune-output "narrowing" } } // This complains about calling frob only in C++11 because // maybe_save_constexpr_fundef fails; in later standards it succeeds, // and the evaluation failure is silent due to the earlier errors. template void get_n(tuple& t) { get()>(t); } // { dg-error "" "" { target c++11_only } } int main() { tuple t; get_n<-1>(t); }