Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/deleted16.C

raw
1 // Verify -fdiagnostics-all-candidates makes us note other candidates
2 // when a deleted function is selected by overload resolution.
3 // { dg-do compile { target c++11 } }
4 // { dg-additional-options "-fdiagnostics-all-candidates" }
5
6 void f(int) = delete; // { dg-message "declared here" }
7 void f(...); // { dg-message "candidate" }
8 void f(int, int); // { dg-message "candidate" }
9
10 // An example where the perfect candidate optimization causes us
11 // to ignore function templates.
12 void g(int) = delete; // { dg-message "declared here" }
13 template<class T> void g(T); // { dg-message "candidate" }
14
15 // An example where we have a strictly viable candidate and
16 // an incompletely considered bad candidate.
17 template<class T> void h(T, T) = delete; // { dg-message "declared here|candidate" }
18 void h(int*, int) = delete; // { dg-message "candidate" }
19
20 int main() {
21 f(0); // { dg-error "deleted" }
22 g(0); // { dg-error "deleted" }
23 h(1, 1); // { dg-error "deleted" }
24 // { dg-error "invalid conversion" "" { target *-*-* } .-1 } when noting 2nd cand
25 }