[prev in list] [next in list] [prev in thread] [next in thread]
List: llvm-bugs
Subject: [llvm-bugs] [Bug 56313] Error with valid defaulted default constructor involving anonymous union
From: LLVM Bugs via llvm-bugs <llvm-bugs () lists ! llvm ! org>
Date: 2022-06-30 18:51:25
Message-ID: 20220630185125.77dd72be9a49e045 () email ! llvm ! org
[Download RAW message or body]
[Attachment #2 (text/html)]
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56313>56313</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Error with valid defaulted default constructor involving anonymous union
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jensmaurer
</td>
</tr>
</table>
<pre>
Test case:
```
struct A {
A() { }
};
struct V {
V() { };
~V() { }
};
struct S {
S();
~S() {}
union {
A a = {};
V v;
};
};
S::S() = default;
```
Result:
```
x.cc:22:4: error: defaulting this default constructor would delete it after its first \
declaration S::S() = default;
^
```
The error goes away if `= default` is replaced with `{}`.
The error message is incorrect, because none of the items in [class.default.ctor] p2 \
applies. In particular, p2.2 does not apply because S::a has a default member \
initializer.
Related gcc bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106150
</pre>
<img width="1px" height="1px" alt="" \
src="http://email.email.llvm.org/o/eJyNU8GOmzAQ_Rq4jIocE0hz4JBtdqVem9VeK2MG8MpgZJuk2a_ \
vGJLNkm6rSmBmPDPPb96Y0lTn4hmdBykcRukuYvuI7aKcXZ7Jdd6O0sMOos3DvAMAu4h_jfg27NG7vxSSkV5yF \
rUvi9qXu9r0Foo2j_fRvyAv8A8L_MOMcId7uOHeYK_xsVemX4BQiyAgSvfXgvRj7AWOS_gP9P6gegjKprt3AoR \
ZYS1G7W-JS8nn9Qe6KefzsfxKpKQY57Ss6QW01thgXMBV34Bvlbv6IE0_62UsnMyoK4po9AjKg6g9WjIc1MrSh \
ahQamGFJ1n-u4kgRPb4j4aeW5xZQmPQgTiJM6gaQtYHuJwBkbY4aCGxgpPy7ZQyjyFnyeeQHTonGgy1qpfGWpQ \
-4t-gRClGh9CbHsHUJEloGLuQRnwfqE_nksvhSRAnyvYwcBDDoBW6BL73MAjrlRxJkgA58IRDFVrojZ_yzu_HX \
HQS0Arq8F37DrsyCNwrr4RWb2iT5ai18NRsIyWUYxO6NzaMHlrvBxcw-RM9FE-afkyMbcijzDeltSDTteb0k_x \
ENipKn1RFiq5YvspYXBVptU23IvbKayweJ7UmVY_EpLpSxOrTi6L6o9HHcJcEKXjuzOjmvyUerS7u2BHoWCbSd \
ORofbx-vgzWvE7jeFLOjejIyPJ0lcZtwRjnq5KlebrdVjWWuJUoeZbXWY4lz7NYixK1K2hSNJdYFZwKWJ6y1dd \
sxbNks6mqDacysd4iW2fRmmEnlE7CwUGn2BYTBxLHUVAr590tSLNXTY94xRejb40tXrF3nRgt2nhiXEx0fwMLn4CL">
[Attachment #3 (text/plain)]
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic