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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to