Debian Codegraph @

gcc/testsuite/g++.dg/cpp1y/auto-fn50.C

raw
1 // PR c++/84906
2 // { dg-do compile { target c++14 } }
3
4 extern "C" int puts(const char*);
5
6 struct aa {
7 operator auto() {
8 puts("auto");
9 return false;
10 }
11 explicit operator bool() {
12 puts("bool");
13 return true;
14 }
15 };
16
17 int main() {
18 aa x;
19 if (x) // { dg-error "ambiguous" }
20 puts("here");
21 else
22 puts("there");
23 }