This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14618] Cannot compile test_thread.cpp from boost
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Mar 2004 13:52:21 -0000
- Subject: [Bug c++/14618] Cannot compile test_thread.cpp from boost
- References: <20040317093829.14618.schmid@snake.iap.physik.tu-darmstadt.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2004-03-17 13:52 -------
I think that the error is actually valid here. Consider
-------------------
class noncopyable
{
protected:
noncopyable() {}
~noncopyable() {}
private:
noncopyable( const noncopyable& );
const noncopyable& operator=( const noncopyable& );
};
struct D : private noncopyable {};
int foo(const D &);
int i = foo (D());
-------------------
You generate a temporary in the call to foo(), and the standard prescribes
that when binding the temporary to the const reference, the copy constructor
of D must be accessible, even if it is unused. Thus, the error
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In copy constructor `D::D(const D&)':
x.cc:7: error: `noncopyable::noncopyable(const noncopyable&)' is private
x.cc:4: error: within this context
seems sensible to me. However, the error messages do not refer to the
line where we attempt to perform this copy (or where the compiler wants
to check that the copy constructor is accessible).
Nathan, Gaby, would you agree?
W.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |gdr at gcc dot gnu dot org,
| |nathan at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14618