Bug 11314 - [DR139] unqualified lookup prefers functions to non-functions
Summary: [DR139] unqualified lookup prefers functions to non-functions
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on: 7874
Blocks:
  Show dependency treegraph
 
Reported: 2003-06-24 20:26 UTC by Martin Sebor
Modified: 2005-12-11 23:19 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 2.95.3 3.0.4 3.2.2 3.2.3 3.3.1 4.0.0 3.4.0
Last reconfirmed: 2005-09-10 19:05:14


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Sebor 2003-06-24 20:26:13 UTC
The program below (example from 3.4.1, p3 corrected by DR139 --
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html#139) is supposed to
return 0. It exits with 1 when compiled with gcc 3.2 suggesting that gcc fails
to correctly implement unqualified lookup. This might be related to PR #11296:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11296

Martin


typedef int f;
namespace N {
    struct A {
        friend int f (A) { return 1; }
        operator int () const { return 0; }
        int g (A a) {
            return f (a);
        }
    };
}

int main ()
{
    return N::A ().g (N::A ());
}
Comment 1 Wolfgang Bangerth 2003-06-28 03:33:15 UTC
Confirmed. What a wicked example :-/
Comment 2 Andrew Pinski 2005-12-11 23:19:25 UTC
This is fixed in 4.1.0 as what is happening before was the friend was injecting when it should not have been.  This was fixed by the patch which fixed PR 7874.