ClaytonKnittel wrote:
> * More importantly, whether the class can be constructed here is not the
> right question. A class whose constructor is never odr-used at all need not
> have that constructor defined anywhere in the program, yet the type can still
> be required to be complete:
> ```
> struct box {
> unsigned long v;
> constexpr box(unsigned long t); // declared, never defined
> };
> unsigned long f(box* p) { return p->v; }
> ```
> Nothing homes box, so no translation unit emits its definition and the
> member is unreachable from a debugger, even though f() reads through it.
This issue seems independent of whether a type has constexpr constructors.
Couldn't you have the following:
```cc
struct box {
unsigned long v;
box(unsigned long t); // declared, never defined
};
unsigned long f(box* p) { return p->v; }
```
and we'd be lacking debug info for `Box`? This seems to break this constructor
homing optimization entirely.
Simple types like this which are never instantiated I'd assume are more likely
to have constexpr constructors than regular constructors, which is maybe why
this issue didn't show up before.
https://github.com/llvm/llvm-project/pull/221566
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits