[LLVMbugs] [Bug 15328] New: Compiler warns about inaccessible copy constructor when binding a reference to a temporary

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Feb 22 01:58:35 PST 2013


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

            Bug ID: 15328
           Summary: Compiler warns about inaccessible copy constructor
                    when binding a reference to a temporary
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dicomj23 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Binding a reference to temporary doesn't require a copy constructor at all:

$ clang --version && cat main.cpp && clang -std=c++98 -Wall main.cpp 
clang version 3.3 (trunk 175738)
Target: i386-pc-linux-gnu
Thread model: posix

int main() {

  struct A {
    static void test(const A &) {}
    A() {}
    private: A(const A &) {}
  };

  A::test(A());

  return 0;
}

main.cpp:10:11: warning: C++98 requires an accessible copy constructor for
class
      'A' when binding a reference to a temporary; was private
      [-Wbind-to-temporary-copy]
  A::test(A());
          ^
main.cpp:7:14: note: declared private here
    private: A(const A &) {}
             ^
1 warning 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/20130222/d2af7257/attachment.html>


More information about the llvm-bugs mailing list