[llvm-bugs] [Bug 27671] New: Clang reports copy constructor being implicitly deleted when it's not called in C++11 mode

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 6 14:38:57 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27671

            Bug ID: 27671
           Summary: Clang reports copy constructor being implicitly
                    deleted when it's not called in C++11 mode
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: wanyingloo at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org,
                    sig-rnd-sat-clang-bugs at synopsys.com
    Classification: Unclassified

The following code compiles successfully in Clang 3.4 and GCC 5.2. Clang 3.5
and higher issues an error in C++11 mode.

$ cat test.cpp
struct Base
{
  Base();
private:
  Base(const Base&);
};
struct D: public Base
{
  D(char*) {}
};
void func() {
  (void)new D("");
}

$ /opt/pkg/gcc-5.2.0/bin/g++ -c -w -std=c++11 test.cpp

$ /opt/pkg/clang-3.4/bin/clang -c -w -std=c++11 test.cpp

$ /opt/pkg/clang-3.5.0/bin/clang -c -w test.cpp

$ /opt/pkg/clang-3.5.0/bin/clang -c -w -std=c++11 test.cpp
test.cpp:12:13: error: call to implicitly-deleted copy constructor of 'D'
  (void)new D("");
            ^ ~~
test.cpp:7:11: note: copy constructor of 'D' is implicitly deleted because base
class 'Base' has an
      inaccessible copy constructor
struct D: public Base
          ^
1 error generated.

-- 
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/20160506/42ecd05a/attachment.html>


More information about the llvm-bugs mailing list