<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 - Misleading error message "unions cannot have base classes""
href="https://bugs.llvm.org/show_bug.cgi?id=46440">46440</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Misleading error message "unions cannot have base classes"
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>haoxintu@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>$cat bug.cc
class A1 {};
class A2 {};
class A3 {};
union : A1, A2, A3 {} u;
$clang++ -c bug.cc
bug.cc:4:1: error: unions cannot have base classes
union : A1, A2, A3 {} u;
^ ~~
bug.cc:4:1: error: unions cannot have base classes
union : A1, A2, A3 {} u;
^ ~~
bug.cc:4:1: error: unions cannot have base classes
union : A1, A2, A3 {} u;
^ ~~
3 errors generated.
In GCC
$g++ -c bug.cc
bug.cc:4:17: error: derived union ‘<unnamed union>’ invalid
4 | union : A1, A2, A3 {} u;
| ^~
I doubt that how clang deal with this case. I guess there are two situations:
1. Clang gives the wrong column number
2. Clang duplicates the error message
According to the marking "~~" in error messages, I guess clang might have the
first issue?
Also, I have tested it in almost all clang versions, they all have this issue.</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>