[LLVMbugs] [Bug 10622] New: invalid defaulted copy constructor if a member is const

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Aug 9 14:22:11 PDT 2011


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

           Summary: invalid defaulted copy constructor if a member is
                    const
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rafael.espindola at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Sorry if this is one of the "know to be missing" items, but there seems to be
quiet a bit of support for "= default" already.

Clang complains when compiling

struct foo {
  const int first;
  constexpr foo(const foo&) = default;
};
void find_or_insert(const foo& __obj) {
  foo x(__obj);
}

the error is

path_service.ii:3:13: error: constructor for 'foo' must explicitly initialize
the const member 'first'
  constexpr foo(const foo&) = default;
            ^
path_service.ii:2:13: note: declared here
  const int first;
            ^
path_service.ii:6:7: note: implicit default copy constructor for 'foo' first
required here
  foo x(__obj);
      ^

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list