https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70271
Bug ID: 70271 Summary: internal compiler error: in dwarf2out_finish, at dwarf2out.c:27346 Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: matthias.hochsteger at tuwien dot ac.at Target Milestone: --- The compiler crashes when creating debug symbols for the given code. command line: g++ -c -g testfile.cpp compiler version: g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/home/matthias/local/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --prefix=/usr --disable-multilib --disable-bootstrap --with-system-zlib --prefix=/home/matthias/local --enable-languages=c,c++,lto --no-create --no-recursion Thread model: posix gcc version 6.0.0 20160317 (experimental) (GCC) //////////////////////////////////////////////////////////////// /// Utility functions to convert capture-less lambdas to function pointers template <typename Function> struct function_traits : public function_traits<decltype(&Function::operator())> { }; template <typename ClassType, typename ReturnType, typename... Args> struct function_traits<ReturnType(ClassType::*)(Args...) const> { typedef ReturnType (*pointer)(Args...); typedef ReturnType return_type; }; template <typename Function> typename function_traits<Function>::pointer FunctionPointer (const Function& lambda) { return static_cast<typename function_traits<Function>::pointer>(lambda); } template <typename Function> typename function_traits<Function>::return_type GetReturnValue (Function func) { typename function_traits<Function>::return_type *dummy; return *dummy; } //////////////////////////////////////////////////////////////// template <typename T> class ClassFoo {}; template <typename T> void FuncBar () { } template <> inline void FuncBar<double> () { typedef void (*func_type)(ClassFoo<double> &); // this code fails with // internal compiler error: in dwarf2out_finish, at dwarf2out.c:27346 // 0x9ec27b dwarf2out_finish // ../../gcc/dwarf2out.c:27346 func_type f1 = FunctionPointer ([](ClassFoo<double> & ref) { }); // this code is working fine // func_type f2 = static_cast<func_type>([](ClassFoo<double> & self) { }); }