[LLVMbugs] [Bug 10043] New: Failure to warn about inaccessible copy constructor of member of class in -Wbind-to-temporary-copy
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat May 28 01:02:39 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10043
Summary: Failure to warn about inaccessible copy constructor of
member of class in -Wbind-to-temporary-copy
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: scshunt at csclub.uwaterloo.ca
ReportedBy: chandlerc at gmail.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
Consider the following code:
% cat y.cc
struct X {
X();
private:
X(const X&) {};
};
struct Y {
X x;
};
struct Z {
Z();
X x;
private:
Z(const Z&);
};
extern void f(const X&);
extern void g(const Y&);
extern void h(const Z&);
void test() {
f(X());
g(Y());
h(Z());
}
% ./bin/clang -fsyntax-only -std=c++98 -Wall y.cc
y.cc:21:5: warning: C++98 requires an accessible copy constructor for class 'X'
when binding a reference to a temporary; was private [-Wbind-to-temporary-copy]
f(X());
^
y.cc:4:3: note: declared private here
X(const X&) {};
^
y.cc:23:5: warning: C++98 requires an accessible copy constructor for class 'Z'
when binding a reference to a temporary; was private [-Wbind-to-temporary-copy]
h(Z());
^
y.cc:13:3: note: declared private here
Z(const Z&);
^
2 warnings generated.
Why doesn't g(Y()) warn? I feel certain that it used to; I think this is a
regression due to the recent work done on copy constructors, especially
implicit ones...
--
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