1 /* PR sanitizer/85774 */ 2 /* { dg-do run } */ 3 4 #include <functional> 5 6 void DoSomething()7DoSomething () 8 { 9 } 10 11 void DoFunc(const std::function<void (void)> & func)12DoFunc (const std::function<void(void)> &func) 13 { 14 func (); 15 } 16 17 void Setup()18Setup () 19 { 20 switch (1) 21 { 22 case 1: 23 { 24 DoFunc ([]() {}); 25 break; 26 } 27 case 2: 28 { 29 DoFunc ([]() {}); 30 break; 31 } 32 default: 33 break; 34 } 35 36 DoSomething (); 37 } 38 39 void DemostrateBadPoisoning()40DemostrateBadPoisoning () 41 { 42 DoFunc ([]() {}); 43 } 44 45 int main()46main () 47 { 48 Setup (); 49 DemostrateBadPoisoning (); 50 return 0; 51 } 52