1 // Testcase from P0305R1
2 // { dg-do compile { target c++17 } }
3 
4 #include <string>
5 #include <map>
6 #include <algorithm>
7 
8 std::map<int, std::string> m;
9 extern int xread (int *);
10 extern void publish (int), xraise (int);
11 
12 void
foo()13 foo ()
14 {
15   if (auto it = m.find (10); it != m.end ()) { std::string s = it->second; }
16   if (char buf[10]; std::fgets(buf, 10, stdin)) { m[0] += buf; }
17   if (int s; int count = xread (&s)) { publish(count); xraise(s); }
18 
19   const char *s;
20   if (auto keywords = {"if", "for", "while"};
21       std::any_of(keywords.begin(), keywords.end(), [&s](const char* kw) { return s == kw; }))
22     {
23       // whatever
24     }
25 }
26