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++/14397] [3.4/3.5 Regression] Trules no longer compile (regression)


------- Additional Comments From bangerth at dealii dot org  2004-03-04 14:05 -------
Confirmed. Here is something even smaller: 
------------- 
struct S { 
    S (int); 
    S(S const&); 
  private: 
    S(S&); 
}; 
 
S foo() 
{ 
  int result = 0; 
  return result; 
} 
---------------- 
 
And we get: 
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -c x.cc 
x.cc: In function `S foo()': 
x.cc:5: error: `S::S(S&)' is private 
x.cc:11: error: within this context 
x.cc:11: error:   initializing temporary from result of `S::S(int)' 
 
Note that apparently gcc calls the conversion constructor, and then wants 
to call the copy constructor to get everything into the return slot (or 
at least wants to make sure that the copy constructor is accessible). However, 
it gets it wrong and looks for the constructor with the non-const argument, 
rather than the one with the constant argument. If I remove the former, 
gcc takes the latter (which is accessible) and is happy with it. 
 
This is a regression on 3.4 and mainline w.r.t. 3.3. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|                            |3.4.0 3.5.0
      Known to work|                            |3.3.4
   Last reconfirmed|0000-00-00 00:00:00         |2004-03-04 14:05:21
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14397


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