[llvm-bugs] [Bug 40293] New: Inconsistent diagnostic between implicitly and explicitly defined default constructor
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jan 11 10:20:44 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=40293
Bug ID: 40293
Summary: Inconsistent diagnostic between implicitly and
explicitly defined default constructor
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: jonathanchesterfield at gmail.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
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,
> 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.
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190111/b9017271/attachment.html>
More information about the llvm-bugs
mailing list