<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 - Inconsistent diagnostic between implicitly and explicitly defined default constructor"
href="https://bugs.llvm.org/show_bug.cgi?id=40293">40293</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Inconsistent diagnostic between implicitly and explicitly defined default constructor
</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>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jonathanchesterfield@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>For `class s {const int x;};`, clang trunk issues
warning: class 's' does not declare any constructor to initialize its
non-modifiable members
If the implicitly defined default constructor is written out,
`class s {s() {}; const int x;};`
error: constructor for 's' must explicitly initialize the const member 'x'
where the equivalent definition is derived from 15.1.7,
<span class="quote">> The implicitly-defined default constructor performs the set of initializations of the class that would be performed by a user-written default constructor for that class with no ctor-initializer (15.6.2) and an empty compound-statement.</span >
Without offering an opinion as to whether warning or error should be preferred
here, I think the two cases should be consistent in their severity.</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>