1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // RUN: %build -O2 11 // RUN: %run 12 13 // <map> 14 15 // Previously this code caused a segfault when compiled at -O2 due to undefined 16 // behavior in __tree. See https://bugs.llvm.org/show_bug.cgi?id=28469 17 18 #include <functional> 19 #include <map> 20 21 void dummy() {} 22 23 struct F { 24 std::map<int, std::function<void()> > m; 25 F() { m[42] = &dummy; } 26 }; 27 28 int main() { 29 F f; 30 f = F(); 31 } 32