public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11808] New: Wrong namespace lookup for template function when induced by a template parameter
@ 2003-08-05 15:56 gcc-bugzilla at gcc dot gnu dot org
  2003-08-05 17:25 ` [Bug c++/11808] [3.4 Regression] " pinskia at physics dot uc dot edu
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2003-08-05 15:56 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=11808

           Summary: Wrong namespace lookup for template function when
                    induced by a template parameter
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nicolas dot burrus at lrde dot epita dot fr
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


This is a refinement of PR c++/11744 which was fixed the
2003-08-01. The bug is still present when the function call is
actually a call to a function template:

namespace nsp_foo {

  struct A {};

  struct foo {};

}

namespace nsp_bar {

  template <class T> // PR 11744 fixed the case where foo took
  void foo(T) {}     // a nsp_foo::A parameter.

  template <class T>
  void bar(T t)
  {
    nsp_bar::foo(t);
  }

}

int main()
{
  nsp_bar::bar(nsp_foo::A());
}

Here is g++-3.4 output:

namespaces.cc: In function `void nsp_bar::bar(T) [with T = nsp_foo::A]':
namespaces.cc:24:   instantiated from here
namespaces.cc:5: error: `struct nsp_foo::foo' is not a function,
namespaces.cc:12: error:   conflict with `template<class T> void
   nsp_bar::foo(T)'
namespaces.cc:17: error:   in call to `foo'

g++-3.3 and above, como and icc accepts this code.

Environment:
System: Linux meissa 2.4.21 #1 Sat Jul 26 02:06:42 CEST 2003 i686 GNU/Linux
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /home/nes/work/lrde/ext/gcc/configure --prefix=/opt/gcc-3.4 --enable-languages=c,c++ : (reconfigured)

How-To-Repeat:
Compile the given code.


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

* [Bug c++/11808] [3.4 Regression] Wrong namespace lookup for template function when induced by a template parameter
  2003-08-05 15:56 [Bug c++/11808] New: Wrong namespace lookup for template function when induced by a template parameter gcc-bugzilla at gcc dot gnu dot org
@ 2003-08-05 17:25 ` pinskia at physics dot uc dot edu
  2003-08-05 18:21 ` [Bug c++/11808] [3.4 regression] " bangerth at dealii dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-05 17:25 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=11808


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmitchel at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
           Priority|P2                          |P1
   Last reconfirmed|0000-00-00 00:00:00         |2003-08-05 17:25:04
               date|                            |
            Summary|Wrong namespace lookup for  |[3.4 Regression] Wrong
                   |template function when      |namespace lookup for
                   |induced by a template       |template function when
                   |parameter                   |induced by a template
                   |                            |parameter
   Target Milestone|---                         |3.4


------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-05 17:25 -------
I can confirm this on the mainline (20030805).
>From Phil's regression hunter: Search converges between 2003-07-13-trunk (#342) and 
2003-07-14-trunk (#343). 
Looks like the same patch that broke PR 11744 broke this one too.


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

* [Bug c++/11808] [3.4 regression] Wrong namespace lookup for template function when induced by a template parameter
  2003-08-05 15:56 [Bug c++/11808] New: Wrong namespace lookup for template function when induced by a template parameter gcc-bugzilla at gcc dot gnu dot org
  2003-08-05 17:25 ` [Bug c++/11808] [3.4 Regression] " pinskia at physics dot uc dot edu
@ 2003-08-05 18:21 ` bangerth at dealii dot org
  2003-08-06  0:09 ` janis187 at us dot ibm dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bangerth at dealii dot org @ 2003-08-05 18: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=11808


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |
            Summary|[3.4 Regression] Wrong      |[3.4 regression] Wrong
                   |namespace lookup for        |namespace lookup for
                   |template function when      |template function when
                   |induced by a template       |induced by a template
                   |parameter                   |parameter


------- Additional Comments From bangerth at dealii dot org  2003-08-05 18:21 -------
Confirmed. Here's a cleaned-up example:
--------------------------
namespace NS_1 {
  struct A {};
  struct foo {};
}

namespace NS_2 {
  template <typename T> void foo(T);

  template <typename T>
  void bar() {
    NS_1::A a;
    NS_2::foo(a);
  }

  template void bar<int>();
}
---------------------------

g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In function `void NS_2::bar() [with T = int]':
x.cc:15:   instantiated from here
x.cc:3: error: `struct NS_1::foo' is not a function,
x.cc:7: error:   conflict with `template<class T> void NS_2::foo(T)'
x.cc:12: error:   in call to `foo'

gcc seems to think it needs to do Koenig lookup, but this is unnecessary
here since the call to foo is namespace-qualified.

W.


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

* [Bug c++/11808] [3.4 regression] Wrong namespace lookup for template function when induced by a template parameter
  2003-08-05 15:56 [Bug c++/11808] New: Wrong namespace lookup for template function when induced by a template parameter gcc-bugzilla at gcc dot gnu dot org
  2003-08-05 17:25 ` [Bug c++/11808] [3.4 Regression] " pinskia at physics dot uc dot edu
  2003-08-05 18:21 ` [Bug c++/11808] [3.4 regression] " bangerth at dealii dot org
@ 2003-08-06  0:09 ` janis187 at us dot ibm dot com
  2003-08-06 14:39 ` bangerth at dealii dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: janis187 at us dot ibm dot com @ 2003-08-06  0:09 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=11808



------- Additional Comments From janis187 at us dot ibm dot com  2003-08-06 00:09 -------
I verfied that the patch that broke 11744 also caused or exposed this
regression, by using the cleaned-up test case from comment #2 with
versions of cc1plus built just before and after that patch on
i686-pc-linux-gnu.


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

* [Bug c++/11808] [3.4 regression] Wrong namespace lookup for template function when induced by a template parameter
  2003-08-05 15:56 [Bug c++/11808] New: Wrong namespace lookup for template function when induced by a template parameter gcc-bugzilla at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2003-08-06  0:09 ` janis187 at us dot ibm dot com
@ 2003-08-06 14:39 ` bangerth at dealii dot org
  2003-08-07 13:22 ` bangerth at dealii dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ 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=11808


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |benko at sztaki dot hu


------- Additional Comments From bangerth at dealii dot org  2003-08-06 14:39 -------
*** Bug 11828 has been marked as a duplicate of this bug. ***


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

* [Bug c++/11808] [3.4 regression] Wrong namespace lookup for template function when induced by a template parameter
  2003-08-05 15:56 [Bug c++/11808] New: Wrong namespace lookup for template function when induced by a template parameter gcc-bugzilla at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2003-08-06 14:39 ` bangerth at dealii dot org
@ 2003-08-07 13:22 ` bangerth at dealii dot org
  2003-08-17 17:38 ` bangerth at dealii dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bangerth at dealii dot org @ 2003-08-07 13:22 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=11808



------- Additional Comments From bangerth at dealii dot org  2003-08-07 13:22 -------
PR 11828 may or may not be a duplicate, but it at least looks very much
related. Whoever comes around to fixing this one should look at the 
other one as well.

W.


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

* [Bug c++/11808] [3.4 regression] Wrong namespace lookup for template function when induced by a template parameter
  2003-08-05 15:56 [Bug c++/11808] New: Wrong namespace lookup for template function when induced by a template parameter gcc-bugzilla at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2003-08-07 13:22 ` bangerth at dealii dot org
@ 2003-08-17 17:38 ` bangerth at dealii dot org
  2003-08-18 21:32 ` bangerth at dealii dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bangerth at dealii dot org @ 2003-08-17 17:38 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=11808


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |raimond_merkert at raytheon
                   |                            |dot com


------- Additional Comments From bangerth at dealii dot org  2003-08-17 17:38 -------
*** Bug 11940 has been marked as a duplicate of this bug. ***


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

* [Bug c++/11808] [3.4 regression] Wrong namespace lookup for template function when induced by a template parameter
  2003-08-05 15:56 [Bug c++/11808] New: Wrong namespace lookup for template function when induced by a template parameter gcc-bugzilla at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2003-08-17 17:38 ` bangerth at dealii dot org
@ 2003-08-18 21:32 ` bangerth at dealii dot org
  2003-09-02 17:32 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bangerth at dealii dot org @ 2003-08-18 21:32 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=11808


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |poschmid at lbl dot gov


------- Additional Comments From bangerth at dealii dot org  2003-08-18 21:32 -------
*** Bug 11970 has been marked as a duplicate of this bug. ***


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

* [Bug c++/11808] [3.4 regression] Wrong namespace lookup for template function when induced by a template parameter
  2003-08-05 15:56 [Bug c++/11808] New: Wrong namespace lookup for template function when induced by a template parameter gcc-bugzilla at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2003-08-18 21:32 ` bangerth at dealii dot org
@ 2003-09-02 17:32 ` cvs-commit at gcc dot gnu dot org
  2003-09-02 17:33 ` mmitchel at gcc dot gnu dot org
  2003-09-03  5:42 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-09-02 17:32 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=11808



------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-09-02 17:32 -------
Subject: Bug 11808

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2003-09-02 17:32:30

Modified files:
	gcc/cp         : ChangeLog cp-tree.h parser.c pt.c semantics.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/expr: call1.C 

Log message:
	PR c++/11808
	* cp-tree.h (KOENIG_LOOKUP_P): New macro.
	(finish_call_expr): Change prototype.
	* parser.c (cp_parser_postfix_expression): Adjust call to
	finish_call_expr.
	* pt.c (tsubst_copy_and_build): Use KOENIG_LOOKUP_P.
	* semantics.c (finish_call_expr): Add koenig_p parameter.
	
	PR c++/11808
	* g++.dg/expr/call1.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3636&r2=1.3637
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.909&r2=1.910
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.105&r2=1.106
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.769&r2=1.770
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.353&r2=1.354
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3016&r2=1.3017
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/expr/call1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1


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

* [Bug c++/11808] [3.4 regression] Wrong namespace lookup for template function when induced by a template parameter
  2003-08-05 15:56 [Bug c++/11808] New: Wrong namespace lookup for template function when induced by a template parameter gcc-bugzilla at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2003-09-02 17:32 ` cvs-commit at gcc dot gnu dot org
@ 2003-09-02 17:33 ` mmitchel at gcc dot gnu dot org
  2003-09-03  5:42 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2003-09-02 17:33 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=11808


mmitchel at gcc dot gnu dot org changed:

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


------- Additional Comments From mmitchel at gcc dot gnu dot org  2003-09-02 17:33 -------
Fixed in GCC 3.4.


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

* [Bug c++/11808] [3.4 regression] Wrong namespace lookup for template function when induced by a template parameter
  2003-08-05 15:56 [Bug c++/11808] New: Wrong namespace lookup for template function when induced by a template parameter gcc-bugzilla at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2003-09-02 17:33 ` mmitchel at gcc dot gnu dot org
@ 2003-09-03  5:42 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-03  5:42 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=11808


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sylvain dot pion at sophia
                   |                            |dot inria dot fr


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-09-03 05:42 -------
*** Bug 12131 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2003-09-03  5:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-05 15:56 [Bug c++/11808] New: Wrong namespace lookup for template function when induced by a template parameter gcc-bugzilla at gcc dot gnu dot org
2003-08-05 17:25 ` [Bug c++/11808] [3.4 Regression] " pinskia at physics dot uc dot edu
2003-08-05 18:21 ` [Bug c++/11808] [3.4 regression] " bangerth at dealii dot org
2003-08-06  0:09 ` janis187 at us dot ibm dot com
2003-08-06 14:39 ` bangerth at dealii dot org
2003-08-07 13:22 ` bangerth at dealii dot org
2003-08-17 17:38 ` bangerth at dealii dot org
2003-08-18 21:32 ` bangerth at dealii dot org
2003-09-02 17:32 ` cvs-commit at gcc dot gnu dot org
2003-09-02 17:33 ` mmitchel at gcc dot gnu dot org
2003-09-03  5:42 ` 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).