[LLVMbugs] [Bug 20208] New: Misleading diagnostic for missing initializer for const POD

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 4 15:22:40 PDT 2014


            Bug ID: 20208
           Summary: Misleading diagnostic for missing initializer for
                    const POD
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ cat test.cc
struct Bar {
  int a;
const Bar bar;
$ clang -c test.cc
test.cc:4:11: error: default initialization of an object of const type 'const
Bar' requires a user-provided default constructor
const Bar bar;
1 error generated.

That's very misleading, since what's missing is the `= {1};` after `const Bar
bar`. Adding a user-provided default constructor probably isn't what's needed

(And for a struct without fields, maybe the code should just be accepted as-is,
even without the `= {}`?)

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/20140704/c2cb1153/attachment.html>

More information about the llvm-bugs mailing list