// 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" } } // { dg-prune-output "flows off the end" } // { dg-prune-output "not a return-statement" } template void get_n(tuple& t) { get()>(t); } // { dg-error "" } int main() { tuple t; get_n<-1>(t); }