https://bugs.llvm.org/show_bug.cgi?id=47556

            Bug ID: 47556
           Summary: Constructor homing missing anonymous union
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedb...@nondot.org
          Reporter: akhu...@google.com
                CC: jdevliegh...@apple.com, keith.wal...@arm.com,
                    llvm-bugs@lists.llvm.org,
                    paul_robin...@playstation.sony.com

This was reported internally but I'll upload it here too. Basically with
-debug-info-kind=constructor the type info for the anonymous union is
incomplete.

$ cat t.cc
void *operator new(unsigned long, void *p) { return p; }

struct TestStruct {
  int val;
};

struct OptionalStorageBase {
  constexpr OptionalStorageBase() : empty_('\0') {}

  union {
    char empty_;
    TestStruct value_;
  };
};

int main() {
  OptionalStorageBase t_opt;
  new (&t_opt.value_) TestStruct(TestStruct{20});
  return t_opt.value_.val;
}
$ clang -cc1 -debug-info-kind=constructor -emit-llvm t.cc -o - | grep
"DW_TAG_union_type,"
$ !30 = !DICompositeType(tag: DW_TAG_union_type, scope: !27, file: !5, line:
10, size: 32, flags: DIFlagFwdDecl, identifier:
"_ZTSN19OptionalStorageBaseUt_E")
$
$ clang -cc1 -debug-info-kind=limited -emit-llvm t.cc -o - | grep
"DW_TAG_union_type"
$ !30 = distinct !DICompositeType(tag: DW_TAG_union_type, scope: !27, file: !5,
line: 10, size: 32, flags: DIFlagExportSymbols | DIFlagTypePassByValue,
elements: !31, identifier: "_ZTSN19OptionalStorageBaseUt_E")

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to