Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A gcc compilation error (concerning copy c'tors) which seems odd (at least to me)
- testref.cpp: In function βint main()β:
- testref.cpp:10: error: βA::A(const A&)β is private
- testref.cpp:20: error: within this context
- #include <cstdio>
- class A {
- public:
- A() { i=0; printf("A ctorn"); }
- ~A() { printf("A dtorn"); }
- private:
- A(const A& other) { i=other.i; printf("A COPY CTORn"); }
- A& operator=(const A& other) { i=other.i; printf("A COPY operatorn"); return *this; }
- private:
- int i;
- };
- void f(const A &aref) {
- printf("dummyn");
- }
- int main() {
- f(A());
- return 0;
- }
- test.cpp:20:7: warning: C++98 requires an accessible copy constructor for class
- 'A' when binding a reference to a temporary; was private
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement