[LLVMbugs] [Bug 18882] New: Default initialization of an object of const type requires user-defined default constructor, even if I provide one.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 18 08:17:00 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=18882

            Bug ID: 18882
           Summary: Default initialization of an object of const type
                    requires user-defined default constructor, even if I
                    provide one.
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: abyss.7 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The code is as follows:

class A {
  public:
    A() = default;
  private:
    int i = 1;
};

int main() {
  const A a;
  return 0;
}

The clang++ gives an error: "error: default initialization of an object of
const type 'const A' requires a user-provided default constructor"

-- 
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/20140218/b1956539/attachment.html>


More information about the llvm-bugs mailing list