1 class LoadedByParamClass {};
2 struct ParamClass {
3 LoadedByParamClass some_func();
4 };
5 struct SomeClass {
6 // LLDB stops in the constructor and then requests
7 // possible expression completions. This will iterate over the
8 // declarations in the translation unit.
9 // The unnamed ParamClass parameter causes that LLDB will add
10 // an incomplete ParamClass decl to the translation unit which
11 // the code completion will find. Upon inspecting the ParamClass
12 // 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 turn
15 // loads the LoadedByParamClass decl. When LoadedByParamClass
16 // is created it will be added to the translation unit which
17 // will invalidate all iterators that currently iterate over
18 // the translation unit. The iterator we use for code completion
19 // is now invalidated and LLDB crashes.
SomeClassSomeClass20 SomeClass(ParamClass) {}
21 };
main()22 int main() { ParamClass e; SomeClass y(e); }
23