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++/13446] [3.3/3.4 regression] gcc uses cast operator when constructing an unnamed instance


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


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