Issue 89406
Summary Wrong/missing debuginfo for struct with default constructor and nested struct declaration
Labels new issue
Assignees
Reporter m-mueller678
    ```
#include<cstdlib>

struct A  {
 int x;

    A(){};

    struct Inner {
        int inner_inner = 0;
    };

    Inner inner;  // exclusive
};

int main(){
    A* a=reinterpret_cast<A*>(malloc(sizeof(A)));
 a->x=0;
}
```
Compiling this with clang and debugging with either gdb or lldb, A is reported as incomplete type or as 'no such type' depending on situation.
`clang++-17 sample.cpp -g -std=c++20 && gdb a.out -ex 'ptype A'`
```
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
 <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.out...
No symbol "A" in current context.
(gdb) 
```

If the constructor is removed, it works as expected.

tested with both of these:
```
Ubuntu clang version 17.0.6 (++20231209124227+6009708b4367-1~exp1~20231209124336.77)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```
```
Ubuntu clang version 15.0.7
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```


_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to