<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Constructor homing missing anonymous union"
href="https://bugs.llvm.org/show_bug.cgi?id=47556">47556</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Constructor homing missing anonymous union
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>DebugInfo
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>akhuang@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
</td>
</tr></table>
<p>
<div>
<pre>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")</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>