[Bug c++/13446] [3.3/3.4 regression] gcc uses cast operator when constructing an unnamed instance

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Fri Dec 19 17:40:00 GMT 2003


------- Additional Comments From bangerth at dealii dot org  2003-12-19 17:20 -------
Interesting. Here's something smaller: 
------------------------ 
struct S; 
 
struct B { 
    operator const S &() const; 
}; 
 
struct S: protected B { 
    S(int i); 
}; 
 
void f(int, const S&); 
 
void g() 
{ 
  f(2,S(3)); 
} 
--------------------------- 
 
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc 
x.cc: In function `void g()': 
x.cc:4: error: `B::operator const S&() const' is inaccessible 
x.cc:15: error: within this context 
x.cc:15: error: `B' is not an accessible base of `S' 
 
This is a regression in 3.2/3.3/3.4 w.r.t 2.95. 
 
The point is that gcc tries to convert the S(3) temporary to a const 
reference using the conversion operator, rather than directly binding 
the temporary. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2003-12-19 17:20:32
               date|                            |
            Summary|gcc uses cast operator when |[3.3/3.4 regression] gcc
                   |constructing an unnamed     |uses cast operator when
                   |instance                    |constructing an unnamed
                   |                            |instance
   Target Milestone|---                         |3.3.3


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



More information about the Gcc-bugs mailing list