public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13830] New: Invalid covariant type for identical type.
@ 2004-01-23 12:04 mattyt-bugzilla at tpg dot com dot au
  2004-01-23 16:26 ` [Bug c++/13830] " bangerth at dealii dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: mattyt-bugzilla at tpg dot com dot au @ 2004-01-23 12:04 UTC (permalink / raw)
  To: gcc-bugs

The code below:

template < class TP >
class A {
public:
   
  friend class X;
   
  typedef X * XP;
   
  class X {};
   
  virtual XP method();
   
};
 
template < class TP >
class B : public A< TP > {
public:
   
  virtual typename A< TP >::XP method();
   
};
 
int main() {
  B<int> a;
}

gives the error in 3.4:

restor5.cc: In instantiation of `B<int>':
restor5.cc:24:   instantiated from here
restor5.cc:19: error: invalid covariant return type for `typename A<TP>::XP
B<TP>::method() [with TP = int]'
restor5.cc:11: error:   overriding `X* A<TP>::method() [with TP = int]'

as best as I can tell, the type is identical and so it should compile.

-- 
           Summary: Invalid covariant type for identical type.
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mattyt-bugzilla at tpg dot com dot au
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13830] Invalid covariant type for identical type.
  2004-01-23 12:04 [Bug c++/13830] New: Invalid covariant type for identical type mattyt-bugzilla at tpg dot com dot au
@ 2004-01-23 16:26 ` bangerth at dealii dot org
  2004-04-23 21:07 ` [Bug c++/13830] Invalid covariant type for identical type, friend related pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2004-01-23 16:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-01-23 16:26 -------
Confirmed. Nathan, your call! 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nathan at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-01-23 16:26:02
               date|                            |


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13830] Invalid covariant type for identical type, friend related
  2004-01-23 12:04 [Bug c++/13830] New: Invalid covariant type for identical type mattyt-bugzilla at tpg dot com dot au
  2004-01-23 16:26 ` [Bug c++/13830] " bangerth at dealii dot org
@ 2004-04-23 21:07 ` pinskia at gcc dot gnu dot org
  2004-04-24  8:26 ` bangerth at dealii dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-23 21:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-23 20:13 -------
Actually it looks like the problem has to do with friend classes.
If I add "class X {};" before the first template class, it works.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
   Last reconfirmed|2004-01-23 16:26:02         |2004-04-23 20:13:18
               date|                            |
            Summary|Invalid covariant type for  |Invalid covariant type for
                   |identical type.             |identical type, friend
                   |                            |related


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13830] Invalid covariant type for identical type, friend related
  2004-01-23 12:04 [Bug c++/13830] New: Invalid covariant type for identical type mattyt-bugzilla at tpg dot com dot au
  2004-01-23 16:26 ` [Bug c++/13830] " bangerth at dealii dot org
  2004-04-23 21:07 ` [Bug c++/13830] Invalid covariant type for identical type, friend related pinskia at gcc dot gnu dot org
@ 2004-04-24  8:26 ` bangerth at dealii dot org
  2004-10-13 15:17 ` lerdsuwa at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2004-04-24  8:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-04-24 05:30 -------
Of course it has to do with friend classes. In the original code, 
in the friend declaration we look up X, don't find anything, and 
inject this name in the global namespace. When we later come back 
in the derived class, we see the friend declaration again, but this 
time we seem to know that the base class also has a member class X and 
think that the friend declaration corresponded to this. 
 
If you add a global class X to the snippet, then the name injection doesn't 
have to happen, and we seem to always believe that the friend declaration 
corresponds to the global class X. 
 
W. 

-- 


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13830] Invalid covariant type for identical type, friend related
  2004-01-23 12:04 [Bug c++/13830] New: Invalid covariant type for identical type mattyt-bugzilla at tpg dot com dot au
                   ` (2 preceding siblings ...)
  2004-04-24  8:26 ` bangerth at dealii dot org
@ 2004-10-13 15:17 ` lerdsuwa at gcc dot gnu dot org
  2004-12-28 15:29 ` lerdsuwa at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-10-13 15:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-10-13 15:17 -------
Working on friend injection issues.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |lerdsuwa at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13830] Invalid covariant type for identical type, friend related
  2004-01-23 12:04 [Bug c++/13830] New: Invalid covariant type for identical type mattyt-bugzilla at tpg dot com dot au
                   ` (3 preceding siblings ...)
  2004-10-13 15:17 ` lerdsuwa at gcc dot gnu dot org
@ 2004-12-28 15:29 ` lerdsuwa at gcc dot gnu dot org
  2005-03-14 14:40 ` lerdsuwa at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-12-28 15:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-12-28 15:29 -------
The patch for PR1016 will also fix this bug.  That patch is ready 
and the plan is getting it in after GCC 4.0 is branched.  I am
closing this as a duplicate.

*** This bug has been marked as a duplicate of 1016 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |1016
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |DUPLICATE


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13830] Invalid covariant type for identical type, friend related
  2004-01-23 12:04 [Bug c++/13830] New: Invalid covariant type for identical type mattyt-bugzilla at tpg dot com dot au
                   ` (4 preceding siblings ...)
  2004-12-28 15:29 ` lerdsuwa at gcc dot gnu dot org
@ 2005-03-14 14:40 ` lerdsuwa at gcc dot gnu dot org
  2005-05-22 11:43 ` lerdsuwa at gcc dot gnu dot org
  2005-05-22 14:06 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2005-03-14 14:40 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 13830 depends on bug 1016, which changed state.

Bug 1016 Summary: [DR 166] friend class declarations not observing namespace rules.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1016

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13830] Invalid covariant type for identical type, friend related
  2004-01-23 12:04 [Bug c++/13830] New: Invalid covariant type for identical type mattyt-bugzilla at tpg dot com dot au
                   ` (5 preceding siblings ...)
  2005-03-14 14:40 ` lerdsuwa at gcc dot gnu dot org
@ 2005-05-22 11:43 ` lerdsuwa at gcc dot gnu dot org
  2005-05-22 14:06 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2005-05-22 11:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2005-05-22 11:42 -------
Also fixed in GCC 4.0.1.

-- 


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13830] Invalid covariant type for identical type, friend related
  2004-01-23 12:04 [Bug c++/13830] New: Invalid covariant type for identical type mattyt-bugzilla at tpg dot com dot au
                   ` (6 preceding siblings ...)
  2005-05-22 11:43 ` lerdsuwa at gcc dot gnu dot org
@ 2005-05-22 14:06 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-22 14:06 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.0.1


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-05-22 14:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-23 12:04 [Bug c++/13830] New: Invalid covariant type for identical type mattyt-bugzilla at tpg dot com dot au
2004-01-23 16:26 ` [Bug c++/13830] " bangerth at dealii dot org
2004-04-23 21:07 ` [Bug c++/13830] Invalid covariant type for identical type, friend related pinskia at gcc dot gnu dot org
2004-04-24  8:26 ` bangerth at dealii dot org
2004-10-13 15:17 ` lerdsuwa at gcc dot gnu dot org
2004-12-28 15:29 ` lerdsuwa at gcc dot gnu dot org
2005-03-14 14:40 ` lerdsuwa at gcc dot gnu dot org
2005-05-22 11:43 ` lerdsuwa at gcc dot gnu dot org
2005-05-22 14:06 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).