23 lines · cpp
1class LoadedByParamClass {};2struct ParamClass {3 LoadedByParamClass some_func();4};5struct SomeClass {6 // LLDB stops in the constructor and then requests7 // possible expression completions. This will iterate over the8 // declarations in the translation unit.9 // The unnamed ParamClass parameter causes that LLDB will add10 // an incomplete ParamClass decl to the translation unit which11 // the code completion will find. Upon inspecting the ParamClass12 // decl to see if it can be used to provide any useful completions,13 // Clang will complete it and load all its members.14 // This causes that its member function some_func is loaded which in turn15 // loads the LoadedByParamClass decl. When LoadedByParamClass16 // is created it will be added to the translation unit which17 // will invalidate all iterators that currently iterate over18 // the translation unit. The iterator we use for code completion19 // is now invalidated and LLDB crashes.20 SomeClass(ParamClass) {}21};22int main() { ParamClass e; SomeClass y(e); }23