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++/14502] [3.3 Regression] g++ compile fails "no matching function" using forward declaration of class involving inheritance


------- Additional Comments From giovannibajo at libero dot it  2004-03-11 04:57 -------
[expr.cast]/6: "The operand of a cast using the cast notation can be an rvalue 
of type ?pointer to incomplete class type?. The destination type of a cast 
using the cast notation can be ?pointer to incomplete class type?. In such 
cases, even if there is a inheritance relationship between the source and 
destination classes, whether the static_cast or reinterpret_cast interpretation 
is used is unspecified."

It looks like both behaviour are actually valid. GCC 3.3.3 uses a static_cast 
and fails. The other GCCs use a reinterpret_cast and succeeds. 

I think it's worth to keep this bug open as an enhancement request for two 
reasons:

- 3.3.4 could be changed to use reinterpret_cast to match 3.4 behaviour. This 
would also restore 3.2 behaviour. I agree it is not strictly needed, but if 
someone is able to do a patch for this, why not.

- If my interpretation is correct and 3.4/3.5 are really using a 
reinterpret_cast, this is silently creating segfaulting code. We could issue a 
warning for the user in this case *if* we detect later that the two types are 
related (when both are completed).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giovannibajo at libero dot
                   |                            |it


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


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