public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early
@ 2003-08-06  9:18 benko at sztaki dot hu
  2003-08-06 14:39 ` [Bug c++/11828] " bangerth at dealii dot org
                   ` (20 more replies)
  0 siblings, 21 replies; 24+ messages in thread
From: benko at sztaki dot hu @ 2003-08-06  9:18 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: [3.4 regression] qualified dependent name looked up too
                    early
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: benko at sztaki dot hu
                CC: gcc-bugs at gcc dot gnu dot org

hydra:~/c/proba$ cat templ_overload.cc
namespace n
{
  template <typename T>
  void
  f(T a)
  {
    a.f();
  }

  template <typename T>
  void
  g(T a)
  {
    n::f(a);
  }
}

struct s
{};

namespace n
{
  void
  f(s)
  {}
}

int
main()
{
  n::g(s());

  return 0;
}
hydra:~/c/proba$ g++-cvs templ_overload.cc
templ_overload.cc: In function `void n::f(T) [with T = s]':
templ_overload.cc:14:   instantiated from `void n::g(T) [with T = s]'
templ_overload.cc:31:   instantiated from here
templ_overload.cc:7: error: 'struct s' has no member named 'f'
zsh: exit 1     g++-cvs templ_overload.cc
hydra:~/c/proba$ g++-cvs -v
Reading specs from /gml/shared/gcc-cvs/lib/gcc/i686-pc-linux-gnu/3.4/specs
Configured with: ../gcc/configure --prefix=/gml/shared/gcc-cvs
--enable-languages=c++
Thread model: posix
gcc version 3.4 20030806 (experimental)
hydra:~/c/proba$ g++3 templ_overload.cc
hydra:~/c/proba$ g++3 -v
Reading specs from /gml/shared/gcc-3.3/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs
Configured with: ../gcc-3.3/configure --prefix=/gml/shared/gcc-3.3
Thread model: posix
gcc version 3.3
hydra:~/c/proba$ 

workarounds:
1. unqualify f in the definition of g.
   I cannot do this, because in real life n=std, f=iter_swap, g=reverse.
2. Move the definition of the overload for f before the definition of g.


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

* [Bug c++/11828] [3.4 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
@ 2003-08-06 14:39 ` bangerth at dealii dot org
  2003-08-07  7:06 ` benko at sztaki dot hu
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: bangerth at dealii dot org @ 2003-08-06 14:39 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


bangerth at dealii dot org changed:

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


------- Additional Comments From bangerth at dealii dot org  2003-08-06 14:39 -------
This is the same problem as PR 11808.

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


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

* [Bug c++/11828] [3.4 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
  2003-08-06 14:39 ` [Bug c++/11828] " bangerth at dealii dot org
@ 2003-08-07  7:06 ` benko at sztaki dot hu
  2003-08-07 13:20 ` bangerth at dealii dot org
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: benko at sztaki dot hu @ 2003-08-07  7:06 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From benko at sztaki dot hu  2003-08-07 07:06 -------
Looking at PR 11808, I think it's different, since this problem vanishes
if at the point of the call all overloads are seen.
What's more, namespaces are not needed at all to reproduce this bug:

hydra:~/c/proba$ cat templ_overload.cc
template <typename T> void f(T a) {a.f();}

template <typename T> void g(T a) {::f(a);}

struct s {};

void f(s) {}

int main()
{
  g(s());
  return 0;
}
hydra:~/c/proba$ g++-cvs templ_overload.cc
templ_overload.cc: In function `void f(T) [with T = s]':
templ_overload.cc:3:   instantiated from `void g(T) [with T = s]'
templ_overload.cc:11:   instantiated from here
templ_overload.cc:1: error: 'struct s' has no member named 'f'
zsh: exit 1     g++-cvs templ_overload.cc
hydra:~/c/proba$ 

But let's see what happens.


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

* [Bug c++/11828] [3.4 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
  2003-08-06 14:39 ` [Bug c++/11828] " bangerth at dealii dot org
  2003-08-07  7:06 ` benko at sztaki dot hu
@ 2003-08-07 13:20 ` bangerth at dealii dot org
  2003-08-07 13:21 ` bangerth at dealii dot org
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: bangerth at dealii dot org @ 2003-08-07 13:20 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


bangerth at dealii dot org changed:

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


------- Additional Comments From bangerth at dealii dot org  2003-08-07 13:20 -------
I still think it's somehow related, after all the global namespace is
also a namespace. But be that as it may, let's reopen this report
and leave a mark in the audit trail of the other PR.

W.


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

* [Bug c++/11828] [3.4 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (2 preceding siblings ...)
  2003-08-07 13:20 ` bangerth at dealii dot org
@ 2003-08-07 13:21 ` bangerth at dealii dot org
  2003-08-11  7:04 ` benko at sztaki dot hu
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: bangerth at dealii dot org @ 2003-08-07 13:21 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-08-07 13:21:10
               date|                            |


------- Additional Comments From bangerth at dealii dot org  2003-08-07 13:21 -------
Re-confirmed with the neat small new testcase provided.
W.


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

* [Bug c++/11828] [3.4 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (3 preceding siblings ...)
  2003-08-07 13:21 ` bangerth at dealii dot org
@ 2003-08-11  7:04 ` benko at sztaki dot hu
  2003-08-11 21:00 ` janis187 at us dot ibm dot com
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: benko at sztaki dot hu @ 2003-08-11  7:04 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From benko at sztaki dot hu  2003-08-11 07:04 -------
Well, yes, the global namespace is a namespace,
but now everything is in the same namespace.
I think I've found the ultimate testcase
(the filename became non-descriptive):

hydra:~/c/proba$ cat templ_overload.cc
template <typename T> void g(T a) {::f(a);}
hydra:~/c/proba$ g++-cvs templ_overload.cc
templ_overload.cc: In function `void g(T)':
templ_overload.cc:1: error: `::f' has not been declared
zsh: exit 1     g++-cvs templ_overload.cc
hydra:~/c/proba$ 

(And let me add that workaround 2, though works, forces
a coding style where everything is included as late as
possible, that is, #include's are not grouped at the beginning
of a file but scattered throughout.)


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

* [Bug c++/11828] [3.4 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (4 preceding siblings ...)
  2003-08-11  7:04 ` benko at sztaki dot hu
@ 2003-08-11 21:00 ` janis187 at us dot ibm dot com
  2003-08-21  6:02 ` mmitchel at gcc dot gnu dot org
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: janis187 at us dot ibm dot com @ 2003-08-11 21:00 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


janis187 at us dot ibm dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmitchel at gcc dot gnu dot
                   |                            |org


------- Additional Comments From janis187 at us dot ibm dot com  2003-08-11 21:00 -------
The regression in PR 11828 was introduced or exposed by the new C++
parser, added to mainline on 2003-12-28.  This was verified on
i686-pc-linux-gnu with cc1plus built just before and just after that
merge, using both the small test case from comment #2 and the
submitter's test case.


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

* [Bug c++/11828] [3.4 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (5 preceding siblings ...)
  2003-08-11 21:00 ` janis187 at us dot ibm dot com
@ 2003-08-21  6:02 ` mmitchel at gcc dot gnu dot org
  2004-04-26 12:57 ` pinskia at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2003-08-21  6:02 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From mmitchel at gcc dot gnu dot org  2003-08-21 06:02 -------
The G++ behavior is correct.

Only those declarations of n::f that were available when g is defined are
available for overload resolution.  See [temp.nondep] in the standard for details.


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

* [Bug c++/11828] [3.4 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (6 preceding siblings ...)
  2003-08-21  6:02 ` mmitchel at gcc dot gnu dot org
@ 2004-04-26 12:57 ` pinskia at gcc dot gnu dot org
  2004-05-11 18:34 ` jason at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-26 12:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-26 11:34 -------
*** Bug 15144 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stefan dot rupp at inform-ac
                   |                            |dot com


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


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

* [Bug c++/11828] [3.4 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (7 preceding siblings ...)
  2004-04-26 12:57 ` pinskia at gcc dot gnu dot org
@ 2004-05-11 18:34 ` jason at gcc dot gnu dot org
  2004-05-11 18:38 ` jason at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: jason at gcc dot gnu dot org @ 2004-05-11 18:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jason at gcc dot gnu dot org  2004-05-10 19:48 -------
*** Bug 15144 has been marked as a duplicate of this bug. ***

-- 


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


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

* [Bug c++/11828] [3.4 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (8 preceding siblings ...)
  2004-05-11 18:34 ` jason at gcc dot gnu dot org
@ 2004-05-11 18:38 ` jason at gcc dot gnu dot org
  2004-05-11 18:53 ` [Bug c++/11828] [3.4/3.5 " pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: jason at gcc dot gnu dot org @ 2004-05-11 18:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jason at gcc dot gnu dot org  2004-05-10 19:51 -------
[temp.nondep] is only relevant if you assume that n::f is a non-dependent name,
which I am not willing to assume.  I believe it is dependent under the principle
outlined in [temp.dep]:

                                                                  In  an
  expression of the form:
                                                                               
                                                 
             postfix-expression ( expression-listopt )
                                                                               
                                                 
  where  the postfix-expression is an identifier, the identifier denotes
  a dependent name if  and  only  if  any  of  the  expressions  in  the
  expression-list  is a type-dependent expression (_temp.dep.expr_).

In this testcase, the postfix-expression is not a plain identifier, but I
believe that it should be handled the same way, and that this is an oversight in
the standard.  EDG seem to agree with me, as 3.4 accepts this testcase and those
from the various duplicates of this bug.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


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


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

* [Bug c++/11828] [3.4/3.5 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (9 preceding siblings ...)
  2004-05-11 18:38 ` jason at gcc dot gnu dot org
@ 2004-05-11 18:53 ` pinskia at gcc dot gnu dot org
  2004-05-11 18:56 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-11 18:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-10 19:55 -------
>From [temp.dep.candidate]:
For a function call that depends on a template parameter, if the function name is an "unqualified-id" 
but not a template-id, the candidate functions are found using the usual lookup rules (3.4.1, 3.4.2) 
except that: 

I think this is more relevent than any other part.
I think the unqualified-id part tells that the function name has to be unqualified.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[3.4 regression] qualified  |[3.4/3.5 regression]
                   |dependent name looked up too|qualified dependent name
                   |early                       |looked up too early
   Target Milestone|3.4.0                       |3.4.1


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


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

* [Bug c++/11828] [3.4/3.5 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (10 preceding siblings ...)
  2004-05-11 18:53 ` [Bug c++/11828] [3.4/3.5 " pinskia at gcc dot gnu dot org
@ 2004-05-11 18:56 ` pinskia at gcc dot gnu dot org
  2004-05-11 19:23 ` bangerth at dealii dot org
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-11 18:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-10 20:00 -------
Note ICC 6.0 in strict mode (-Xc -ansi) rejects the testcase in PR15367 with:
pr11828.cc
pr11828.cc(6): error: no instance of overloaded function "f" matches the argument list
            argument types are: (A)
    ::f (t);
    ^
          detected during instantiation of "void g(T) [with T=A]"

compilation aborted for pr11828.cc (code 2)

-- 


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


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

* [Bug c++/11828] [3.4/3.5 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (11 preceding siblings ...)
  2004-05-11 18:56 ` pinskia at gcc dot gnu dot org
@ 2004-05-11 19:23 ` bangerth at dealii dot org
  2004-05-11 19:24 ` jason at redhat dot com
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: bangerth at dealii dot org @ 2004-05-11 19:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-05-10 20:16 -------
As does icc7 when given -Xc -ansi. It accepts the testcase in default 
mode, though. Jason, when you say you tested it with EDG, did you specify 
the flags for maximal standard conformance? 
 
W. 

-- 


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


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

* [Bug c++/11828] [3.4/3.5 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (12 preceding siblings ...)
  2004-05-11 19:23 ` bangerth at dealii dot org
@ 2004-05-11 19:24 ` jason at redhat dot com
  2004-05-11 19:37 ` bangerth at dealii dot org
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: jason at redhat dot com @ 2004-05-11 19:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jason at redhat dot com  2004-05-10 20:22 -------
Subject: Re:  [3.4/3.5 regression] qualified dependent name
 looked up too early

On 10 May 2004 20:16:59 -0000, "bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> wrote:

> As does icc7 when given -Xc -ansi. It accepts the testcase in default 
> mode, though. Jason, when you say you tested it with EDG, did you specify 
> the flags for maximal standard conformance? 

I used -A, which I believe is the relevant flag.

Jason


-- 


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


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

* [Bug c++/11828] [3.4/3.5 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (13 preceding siblings ...)
  2004-05-11 19:24 ` jason at redhat dot com
@ 2004-05-11 19:37 ` bangerth at dealii dot org
  2004-06-03 22:29 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: bangerth at dealii dot org @ 2004-05-11 19:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-05-10 20:33 -------
Hm, on my linux box and with icc, -A is a preprocessor flag... 
W. 

-- 


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


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

* [Bug c++/11828] [3.4/3.5 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (14 preceding siblings ...)
  2004-05-11 19:37 ` bangerth at dealii dot org
@ 2004-06-03 22:29 ` pinskia at gcc dot gnu dot org
  2004-06-10 20:04 ` jason at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-03 22:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-03 22:29 -------
*** Bug 15814 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rdelashmit at soe dot sony
                   |                            |dot com


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


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

* [Bug c++/11828] [3.4/3.5 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (15 preceding siblings ...)
  2004-06-03 22:29 ` pinskia at gcc dot gnu dot org
@ 2004-06-10 20:04 ` jason at gcc dot gnu dot org
  2004-10-28 13:53 ` [Bug c++/11828] [3.4/4.0 " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: jason at gcc dot gnu dot org @ 2004-06-10 20:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jason at gcc dot gnu dot org  2004-06-10 20:04 -------
I now agree that this is the intent of the committee.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c++/11828] [3.4/4.0 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (16 preceding siblings ...)
  2004-06-10 20:04 ` jason at gcc dot gnu dot org
@ 2004-10-28 13:53 ` pinskia at gcc dot gnu dot org
  2005-02-21 19:12 ` smcpeak at cs dot berkeley dot edu
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-28 13:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-28 13:53 -------
*** Bug 18195 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schepler at math dot
                   |                            |berkeley dot edu


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


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

* [Bug c++/11828] [3.4/4.0 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (17 preceding siblings ...)
  2004-10-28 13:53 ` [Bug c++/11828] [3.4/4.0 " pinskia at gcc dot gnu dot org
@ 2005-02-21 19:12 ` smcpeak at cs dot berkeley dot edu
  2005-03-03 22:55 ` pinskia at gcc dot gnu dot org
  2005-03-04  5:00 ` smcpeak at cs dot berkeley dot edu
  20 siblings, 0 replies; 24+ messages in thread
From: smcpeak at cs dot berkeley dot edu @ 2005-02-21 19:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From smcpeak at cs dot berkeley dot edu  2005-02-21 02:41 -------
I question the apparent conclusion reached in this discussion.  The
reporter's testcase refers to

  n::f(a)

where 'a' has dependent type.

The conclusion so far is that 'f' is not dependent because it is
qualified.  The primary justification offered is that 14.6.2p1
mentions exactly two syntactic cases of dependent names:

  - function call with a simple 'identifier' as the function
  - operator in an expression

However, as discussed here and elsewhere
(e.g., http://gcc.gnu.org/onlinedocs/gcc/Name-lookup.html),
there is general consensus that the following forms also make
'f' dependent:

  - x->f(a)          // when x is a type-dependent expression
  - C::f(a)          // when C is a dependent type

Therefore, my interpretation is that the two cases given in 14.6.2 are
*not* exhaustive, but rather merely examples.  14.6.2 first gives some
general properties of dependent names (e.g., "... semantics which may
differ from one instantiation to another.") that clearly apply to more
situations.  And 14.6.4.2 singles out unqualified names as a special
case---why would they be a special case if only unqualified names
could be dependent?

Now, it is true that the two additional generally-agreed-upon cases
above are "doubly" dependent: not only do they have arguments of
dependent type, but their receiver object or qualifier is also of
dependent type.  Consequently, the expressions are type-dependent
(14.6.2.2 p1, p3 resp.); but the standard never says that being part
of a type-dependent expression automatically makes the name dependent!
On the contrary, 14.6.2.2p4 gives several counterexamples.  Moreover,
in the simple case "f(a)", 'f' is not a type-dependent expression, and
yet it is clearly a dependent name.

Extrapolating from the first few sentences of 14.6.2, it seems to me
that the following are exhaustive representatives of cases where the
name 'foo' is dependent:

A.  Cases where function overload resolution is performed, and
influenced by some type that might be dependent:

  A1. foo(a,b,c)
  A2. C::foo(a,b,c)
  A3. x->foo(a,b,c)
  A4. x->C::foo(a,b,c)

when a or b or c is a type-dependent expression.

B.  Cases where lookup involves traversing a class with dependent
type:

  B1. C::foo
  B2. x->foo
  B3. x->C::foo

when C is a dependent type, or x is a type-dependent expression.

C.  Cases when the address of an overloaded function is matched to a
target type (13.4) that is dependent.  This would include all
variations of

  C.  [&][x->][C::]foo

where by brackets ([]) I mean optional component.

In all cases (except case C, I *think*) 'foo' could be a template-id,
and would still be dependent.  (Plus the case of operators in
expressions where an operand is a type-dependent expr.)


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smcpeak at cs dot berkeley
                   |                            |dot edu


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


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

* [Bug c++/11828] [3.4/4.0 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (18 preceding siblings ...)
  2005-02-21 19:12 ` smcpeak at cs dot berkeley dot edu
@ 2005-03-03 22:55 ` pinskia at gcc dot gnu dot org
  2005-03-04  5:00 ` smcpeak at cs dot berkeley dot edu
  20 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-03 22:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-03 22:55 -------
*** Bug 20307 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vasilche at ncbi dot nlm dot
                   |                            |nih dot gov


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


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

* [Bug c++/11828] [3.4/4.0 regression] qualified dependent name looked up too early
  2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
                   ` (19 preceding siblings ...)
  2005-03-03 22:55 ` pinskia at gcc dot gnu dot org
@ 2005-03-04  5:00 ` smcpeak at cs dot berkeley dot edu
  20 siblings, 0 replies; 24+ messages in thread
From: smcpeak at cs dot berkeley dot edu @ 2005-03-04  5:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From smcpeak at cs dot berkeley dot edu  2005-03-04 05:00 -------
I think I have answered my own question: indeed, qualified lookup
only considers name from the definition context, and not the
instantiation context.

I found this thread at google groups:

 
http://groups-beta.google.com/group/comp.std.c++/browse_thread/thread/22521f9b57b995d0/73d79aadca8c665c

Quoting from a few of the more useful messages:

  http://groups-beta.google.com/group/comp.std.c++/msg/ae689cfc9c99262d

    Moving to templates. Point of definition does both normal and argument
    dependent lookup, point of instantiation does ADL only (14.6.4/1.)

    When you disable ADL by writing N::foo(x), the only lookup that
    remains is normal lookup done at point of definition. Point of
    instantiation lookup is implicitly disabled as a consequence of the
    interaction between 3.4.2/1 and 14.6.4/1.

  http://groups-beta.google.com/group/comp.std.c++/msg/0e252a95da0f453d

    The OL
    part happens at the point of definition (phase 1), and  the ADL
    part happens at the POI (point of instantiation; phase 2).  If
    you remove the ADL part, you're left with a phase 1 lookup only.

  http://groups-beta.google.com/group/comp.std.c++/msg/6a53b35efe39fee3

    The compromise that was reached was to say that lexical lookup
    would occur only in the definition context; only ADL would be
    performed in the instantiation context.  Since qualified
    function names do not participate in ADL, any arguments in a
    call to a qualified name are ignored in determining whether a
    qualified name is dependent or not.

The upshot is that, by 14.6.4p1, second-phase lookup *only* does
argument-dependent lookup, which is itself disabled by qualification.

This has some nasty consequences, e.g.

  http://groups-beta.google.com/group/comp.std.c++/msg/8379998d36b27a99

but appears to be the genuine intent of the committee.


-- 


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


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

* [Bug c++/11828] [3.4/4.0 regression] qualified dependent name looked up too early
       [not found] <bug-11828-2595@http.gcc.gnu.org/bugzilla/>
  2006-02-07  2:24 ` pinskia at gcc dot gnu dot org
@ 2006-02-08 17:44 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-08 17:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #24 from pinskia at gcc dot gnu dot org  2006-02-08 17:44 -------
*** Bug 26148 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug c++/11828] [3.4/4.0 regression] qualified dependent name looked up too early
       [not found] <bug-11828-2595@http.gcc.gnu.org/bugzilla/>
@ 2006-02-07  2:24 ` pinskia at gcc dot gnu dot org
  2006-02-08 17:44 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-07  2:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #23 from pinskia at gcc dot gnu dot org  2006-02-07 02:24 -------
*** Bug 26148 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gcc_bugzilla at friedman dot
                   |                            |to


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


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

end of thread, other threads:[~2006-02-08 17:44 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-06  9:18 [Bug c++/11828] New: [3.4 regression] qualified dependent name looked up too early benko at sztaki dot hu
2003-08-06 14:39 ` [Bug c++/11828] " bangerth at dealii dot org
2003-08-07  7:06 ` benko at sztaki dot hu
2003-08-07 13:20 ` bangerth at dealii dot org
2003-08-07 13:21 ` bangerth at dealii dot org
2003-08-11  7:04 ` benko at sztaki dot hu
2003-08-11 21:00 ` janis187 at us dot ibm dot com
2003-08-21  6:02 ` mmitchel at gcc dot gnu dot org
2004-04-26 12:57 ` pinskia at gcc dot gnu dot org
2004-05-11 18:34 ` jason at gcc dot gnu dot org
2004-05-11 18:38 ` jason at gcc dot gnu dot org
2004-05-11 18:53 ` [Bug c++/11828] [3.4/3.5 " pinskia at gcc dot gnu dot org
2004-05-11 18:56 ` pinskia at gcc dot gnu dot org
2004-05-11 19:23 ` bangerth at dealii dot org
2004-05-11 19:24 ` jason at redhat dot com
2004-05-11 19:37 ` bangerth at dealii dot org
2004-06-03 22:29 ` pinskia at gcc dot gnu dot org
2004-06-10 20:04 ` jason at gcc dot gnu dot org
2004-10-28 13:53 ` [Bug c++/11828] [3.4/4.0 " pinskia at gcc dot gnu dot org
2005-02-21 19:12 ` smcpeak at cs dot berkeley dot edu
2005-03-03 22:55 ` pinskia at gcc dot gnu dot org
2005-03-04  5:00 ` smcpeak at cs dot berkeley dot edu
     [not found] <bug-11828-2595@http.gcc.gnu.org/bugzilla/>
2006-02-07  2:24 ` pinskia at gcc dot gnu dot org
2006-02-08 17:44 ` 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).