This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/14618] Cannot compile test_thread.cpp from boost


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]