public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21181] New: namespace lookup error message misleading
@ 2005-04-23 20:27 tneumann at pi3 dot informatik dot uni-mannheim dot de
  2005-04-23 20:38 ` [Bug c++/21181] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: tneumann at pi3 dot informatik dot uni-mannheim dot de @ 2005-04-23 20:27 UTC (permalink / raw)
  To: gcc-bugs

Consider the following C++ code:

class A;
namespace X {
class B { friend class A; };
}
using namespace X;
class A {};
A a;

In the last line the compiler complains that A is undefined. After reading the 
release notes I understamd what happens (although I'm surprised. E.g. Comeau 
accepts the code). 
However the error message is very misleading: The problem is not that A is 
undefined but that X::A is undefined! This is very confusing for users.

-- 
           Summary: namespace lookup error message misleading
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tneumann at pi3 dot informatik dot uni-mannheim dot de
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/21181] namespace lookup error message misleading
  2005-04-23 20:27 [Bug c++/21181] New: namespace lookup error message misleading tneumann at pi3 dot informatik dot uni-mannheim dot de
@ 2005-04-23 20:38 ` pinskia at gcc dot gnu dot org
  2005-04-24 15:23 ` Woebbeking at web dot de
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-23 20:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-23 20:38 -------
This is a dup of bug 19403.  The problem is that GCC before 4.0.0, the friend was saying the wrong 
friend was a friend of B.  But in 4.0.0 we get that right but a decided that the class was declared in the 
namespace which is wrong, it should not be injected.  This is all fixed already on the mainline.

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

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

* [Bug c++/21181] namespace lookup error message misleading
  2005-04-23 20:27 [Bug c++/21181] New: namespace lookup error message misleading tneumann at pi3 dot informatik dot uni-mannheim dot de
  2005-04-23 20:38 ` [Bug c++/21181] " pinskia at gcc dot gnu dot org
@ 2005-04-24 15:23 ` Woebbeking at web dot de
  2005-04-24 16:01 ` Woebbeking at web dot de
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Woebbeking at web dot de @ 2005-04-24 15:23 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 382 bytes --]


------- Additional Comments From Woebbeking at web dot de  2005-04-24 15:23 -------
Hi, 
 
he's not complaining about the "new" friend lookup behaviour but about the 
misleading error message. I had two similar cases and it was not easy to find 
out what was going on. Have a look at the attachments. 
 
 
Cheers, 
André 

-- 


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


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

* [Bug c++/21181] namespace lookup error message misleading
  2005-04-23 20:27 [Bug c++/21181] New: namespace lookup error message misleading tneumann at pi3 dot informatik dot uni-mannheim dot de
  2005-04-23 20:38 ` [Bug c++/21181] " pinskia at gcc dot gnu dot org
  2005-04-24 15:23 ` Woebbeking at web dot de
@ 2005-04-24 16:01 ` Woebbeking at web dot de
  2005-04-24 16:05 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Woebbeking at web dot de @ 2005-04-24 16:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From Woebbeking at web dot de  2005-04-24 16:01 -------
One additional note: if I use a named namespace in the 2nd case it compiles 
fine. Dunno if this is a bug. 

-- 


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


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

* [Bug c++/21181] namespace lookup error message misleading
  2005-04-23 20:27 [Bug c++/21181] New: namespace lookup error message misleading tneumann at pi3 dot informatik dot uni-mannheim dot de
                   ` (2 preceding siblings ...)
  2005-04-24 16:01 ` Woebbeking at web dot de
@ 2005-04-24 16:05 ` pinskia at gcc dot gnu dot org
  2005-04-24 16:18 ` Woebbeking at web dot de
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-24 16:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-24 16:05 -------
(In reply to comment #2)
> Hi, 
>  
> he's not complaining about the "new" friend lookup behaviour but about the 
> misleading error message. I had two similar cases and it was not easy to find 
> out what was going on. Have a look at the attachments. 

That would then be PR 12272, PR 20293, and PR 16093 and a couple other PRs.

-- 


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


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

* [Bug c++/21181] namespace lookup error message misleading
  2005-04-23 20:27 [Bug c++/21181] New: namespace lookup error message misleading tneumann at pi3 dot informatik dot uni-mannheim dot de
                   ` (3 preceding siblings ...)
  2005-04-24 16:05 ` pinskia at gcc dot gnu dot org
@ 2005-04-24 16:18 ` Woebbeking at web dot de
  2005-04-24 16:20 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Woebbeking at web dot de @ 2005-04-24 16:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From Woebbeking at web dot de  2005-04-24 16:17 -------
Are you sure? None of the given PRs uses friend declarations. In my two cases I 
only have to use friend struct ::S1 and all is fine but to find the broken 
friend declarations is PITA. 

-- 


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


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

* [Bug c++/21181] namespace lookup error message misleading
  2005-04-23 20:27 [Bug c++/21181] New: namespace lookup error message misleading tneumann at pi3 dot informatik dot uni-mannheim dot de
                   ` (4 preceding siblings ...)
  2005-04-24 16:18 ` Woebbeking at web dot de
@ 2005-04-24 16:20 ` pinskia at gcc dot gnu dot org
  2005-04-24 17:24 ` Woebbeking at web dot de
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-24 16:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-24 16:20 -------
(In reply to comment #7)
> Are you sure? None of the given PRs uses friend declarations. In my two cases I 
> only have to use friend struct ::S1 and all is fine but to find the broken 
> friend declarations is PITA. 

Yes and that is the correct way otherwise you get the wrong class declared as a friend, again this is a 
dup of bug 19403 which is fixed correctly in 4.1.0 and above in that the friend statement is no longer a 
declaration of a class but just a marking on the class if it exists in the future the class is a friend of the 
other class.

-- 


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


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

* [Bug c++/21181] namespace lookup error message misleading
  2005-04-23 20:27 [Bug c++/21181] New: namespace lookup error message misleading tneumann at pi3 dot informatik dot uni-mannheim dot de
                   ` (5 preceding siblings ...)
  2005-04-24 16:20 ` pinskia at gcc dot gnu dot org
@ 2005-04-24 17:24 ` Woebbeking at web dot de
  2005-04-24 17:27 ` pinskia at gcc dot gnu dot org
  2005-04-24 19:45 ` Woebbeking at web dot de
  8 siblings, 0 replies; 10+ messages in thread
From: Woebbeking at web dot de @ 2005-04-24 17:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From Woebbeking at web dot de  2005-04-24 17:24 -------
I see. Then I'm looking forward to 4.1 :-) 
 
One last thing: is it a bug that the behaviour differs for named namespace in 
my second example? 

-- 


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


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

* [Bug c++/21181] namespace lookup error message misleading
  2005-04-23 20:27 [Bug c++/21181] New: namespace lookup error message misleading tneumann at pi3 dot informatik dot uni-mannheim dot de
                   ` (6 preceding siblings ...)
  2005-04-24 17:24 ` Woebbeking at web dot de
@ 2005-04-24 17:27 ` pinskia at gcc dot gnu dot org
  2005-04-24 19:45 ` Woebbeking at web dot de
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-24 17:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-24 17:27 -------
(In reply to comment #9)
> I see. Then I'm looking forward to 4.1 :-) 
>  
> One last thing: is it a bug that the behaviour differs for named namespace in 
> my second example? 

You second example is about equivant to before GCC fixes the friend bug for declaring the class in the 
namespace:
struct S1
{
    S1();
};

namespace
{
    struct S1;
    struct S2
    {
        friend struct S1;
    };
}

S1::S1()
{
}

So S1 ambiguous in the global namespace.

-- 


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


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

* [Bug c++/21181] namespace lookup error message misleading
  2005-04-23 20:27 [Bug c++/21181] New: namespace lookup error message misleading tneumann at pi3 dot informatik dot uni-mannheim dot de
                   ` (7 preceding siblings ...)
  2005-04-24 17:27 ` pinskia at gcc dot gnu dot org
@ 2005-04-24 19:45 ` Woebbeking at web dot de
  8 siblings, 0 replies; 10+ messages in thread
From: Woebbeking at web dot de @ 2005-04-24 19:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From Woebbeking at web dot de  2005-04-24 19:45 -------
Thanks for enlightening me. 

-- 


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


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

end of thread, other threads:[~2005-04-24 19:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-23 20:27 [Bug c++/21181] New: namespace lookup error message misleading tneumann at pi3 dot informatik dot uni-mannheim dot de
2005-04-23 20:38 ` [Bug c++/21181] " pinskia at gcc dot gnu dot org
2005-04-24 15:23 ` Woebbeking at web dot de
2005-04-24 16:01 ` Woebbeking at web dot de
2005-04-24 16:05 ` pinskia at gcc dot gnu dot org
2005-04-24 16:18 ` Woebbeking at web dot de
2005-04-24 16:20 ` pinskia at gcc dot gnu dot org
2005-04-24 17:24 ` Woebbeking at web dot de
2005-04-24 17:27 ` pinskia at gcc dot gnu dot org
2005-04-24 19:45 ` Woebbeking at web dot de

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