public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34827]  New: Weird name-lookup error
@ 2008-01-17 14:37 rguenth at gcc dot gnu dot org
  2008-12-30  5:47 ` [Bug c++/34827] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-17 14:37 UTC (permalink / raw)
  To: gcc-bugs

template <typename T>
struct Foo
{
    template <typename Z>
    friend void func(const Foo &);
};

void check(const Foo<int> & x)
{
    Foo<int> weird;

    func<int>(x);
}


func is incorrectly found by name-lookup.  If you delete the
declaration of weird the program is rejected as it should.

Maybe we are confused by applying argument dependent name-lookup
here?


-- 
           Summary: Weird name-lookup error
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


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

* [Bug c++/34827] Weird name-lookup error
  2008-01-17 14:37 [Bug c++/34827] New: Weird name-lookup error rguenth at gcc dot gnu dot org
@ 2008-12-30  5:47 ` pinskia at gcc dot gnu dot org
  2008-12-30 10:23 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-30  5:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-12-30 05:45 -------
>func is incorrectly found by name-lookup.
No it should be found even without the "Foo<int> weird;"

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


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/34827] Weird name-lookup error
  2008-01-17 14:37 [Bug c++/34827] New: Weird name-lookup error rguenth at gcc dot gnu dot org
  2008-12-30  5:47 ` [Bug c++/34827] " pinskia at gcc dot gnu dot org
@ 2008-12-30 10:23 ` rguenth at gcc dot gnu dot org
  2008-12-30 10:43 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-12-30 10:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2008-12-30 10:20 -------
IMHO the friend declaration isn't a declaration for func, no?  At least it
shouldn't inject the name into Foo<T>?


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/34827] Weird name-lookup error
  2008-01-17 14:37 [Bug c++/34827] New: Weird name-lookup error rguenth at gcc dot gnu dot org
  2008-12-30  5:47 ` [Bug c++/34827] " pinskia at gcc dot gnu dot org
  2008-12-30 10:23 ` rguenth at gcc dot gnu dot org
@ 2008-12-30 10:43 ` rguenth at gcc dot gnu dot org
  2008-12-30 11:43 ` dragan at plusplus dot co dot yu
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-12-30 10:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2008-12-30 10:42 -------
EDG reports (in strict-ansi mode - otherwise the friend decl injects the name)

icpc -S t.C -strict_ansi
t.C(12): error: identifier "func" is undefined
    func<int>(x);
    ^

t.C(12): error: type name is not allowed
    func<int>(x);
         ^

compilation aborted for t.C (code 2)


with and without the "weird" decl.  Which is IMHO correct.


-- 


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


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

* [Bug c++/34827] Weird name-lookup error
  2008-01-17 14:37 [Bug c++/34827] New: Weird name-lookup error rguenth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-12-30 10:43 ` rguenth at gcc dot gnu dot org
@ 2008-12-30 11:43 ` dragan at plusplus dot co dot yu
  2008-12-30 11:47 ` rguenth at gcc dot gnu dot org
  2008-12-30 11:48 ` rguenther at suse dot de
  5 siblings, 0 replies; 7+ messages in thread
From: dragan at plusplus dot co dot yu @ 2008-12-30 11:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dragan at plusplus dot co dot yu  2008-12-30 11:42 -------
Please see my bug report #34870. There are references to discussions
and other sources that show why this code is valid.

Hm... Apparently, this is exactly my test case. :-D


-- 


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


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

* [Bug c++/34827] Weird name-lookup error
  2008-01-17 14:37 [Bug c++/34827] New: Weird name-lookup error rguenth at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-12-30 11:43 ` dragan at plusplus dot co dot yu
@ 2008-12-30 11:47 ` rguenth at gcc dot gnu dot org
  2008-12-30 11:48 ` rguenther at suse dot de
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-12-30 11:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2008-12-30 11:44 -------


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


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/34827] Weird name-lookup error
  2008-01-17 14:37 [Bug c++/34827] New: Weird name-lookup error rguenth at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-12-30 11:47 ` rguenth at gcc dot gnu dot org
@ 2008-12-30 11:48 ` rguenther at suse dot de
  5 siblings, 0 replies; 7+ messages in thread
From: rguenther at suse dot de @ 2008-12-30 11:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenther at suse dot de  2008-12-30 11:46 -------
Subject: Re:  Weird name-lookup error

On Tue, 30 Dec 2008, dragan at plusplus dot co dot yu wrote:

> ------- Comment #4 from dragan at plusplus dot co dot yu  2008-12-30 11:42 -------
> Please see my bug report #34870. There are references to discussions
> and other sources that show why this code is valid.
> 
> Hm... Apparently, this is exactly my test case. :-D

Indeed.  Still it's invalid.

Richard.


-- 


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


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

end of thread, other threads:[~2008-12-30 11:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-17 14:37 [Bug c++/34827] New: Weird name-lookup error rguenth at gcc dot gnu dot org
2008-12-30  5:47 ` [Bug c++/34827] " pinskia at gcc dot gnu dot org
2008-12-30 10:23 ` rguenth at gcc dot gnu dot org
2008-12-30 10:43 ` rguenth at gcc dot gnu dot org
2008-12-30 11:43 ` dragan at plusplus dot co dot yu
2008-12-30 11:47 ` rguenth at gcc dot gnu dot org
2008-12-30 11:48 ` rguenther at suse 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).