C
Christoph Bartoschek
Hi,
gcc 3.4 rejects the following program:
class T {
public:
T() : a(3) {}
explicit T(T const & other) : a(other.a) {}
private:
int a;
};
void func(T const & obj) {
}
int main() {
func(T());
}
The error is:
no matching function for call to `T::T(const T&)'
There is some reasoning about it at:
http://gcc.gnu.org/bugs.html#cxx_rvalbind
This seems to be correct for private copy constructors, but I am not sure
whether the interpretation by the gcc team also applies to explicit copy
constructors. Is there some discussion about the correct interpretation of
the standard for explicit copy constructors?
Christoph Bartoschek
gcc 3.4 rejects the following program:
class T {
public:
T() : a(3) {}
explicit T(T const & other) : a(other.a) {}
private:
int a;
};
void func(T const & obj) {
}
int main() {
func(T());
}
The error is:
no matching function for call to `T::T(const T&)'
There is some reasoning about it at:
http://gcc.gnu.org/bugs.html#cxx_rvalbind
This seems to be correct for private copy constructors, but I am not sure
whether the interpretation by the gcc team also applies to explicit copy
constructors. Is there some discussion about the correct interpretation of
the standard for explicit copy constructors?
Christoph Bartoschek