public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/10146: [3.4 regression] [new parser] template function lookup failure(s)
@ 2003-03-19 12:26 Richard Guenther
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Guenther @ 2003-03-19 12:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10146; it has been noted by GNATS.

From: Richard Guenther <rguenth@tat.physik.uni-tuebingen.de>
To: Giovanni Bajo <giovannibajo@libero.it>
Cc: gcc-gnats@gcc.gnu.org, <gcc-bugs@gcc.gnu.org>, <nobody@gcc.gnu.org>,
   <gcc-prs@gcc.gnu.org>
Subject: Re: c++/10146: [3.4 regression] [new parser] template function lookup
 failure(s)
Date: Wed, 19 Mar 2003 13:20:42 +0100 (CET)

 On Wed, 19 Mar 2003, Giovanni Bajo wrote:
 
 >
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
 > r=10146
 >
 > To sum it up:
 >
 > >Foo<int>().template foo<U>(u); // does not work
 > >Foo<int>().template bar<U>(u); // does not work
 >
 > These should compile.
 >
 > >Foo<int>().foo(u);             // does work ??
 > >Foo<int>::foo(u);              // does work ??
 > >Foo<int>().bar(u);             // does work ??
 >
 > Yes, because the template parameter of the template member function is
 > deduced from the call. What's wrong with them?
 
 I think foo() and bar() needs to be qualified with the template keyword
 due to two-stage namelookup. But I may be wrong (dont have a standard
 to look at).
 
 Richard.
 
 --
 Richard Guenther <richard.guenther@uni-tuebingen.de>
 WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
 


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

* Re: c++/10146: [3.4 regression] [new parser] template function lookup failure(s)
@ 2003-03-20  2:05 bangerth
  0 siblings, 0 replies; 9+ messages in thread
From: bangerth @ 2003-03-20  2:05 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, rguenth

Synopsis: [3.4 regression] [new parser] template function lookup failure(s)

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Thu Mar 20 02:04:59 2003
State-Changed-Why:
    Giovanni did this already

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10146


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

* Re: c++/10146: [3.4 regression] [new parser] template function lookup failure(s)
@ 2003-03-19 12:56 Richard Guenther
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Guenther @ 2003-03-19 12:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10146; it has been noted by GNATS.

From: Richard Guenther <rguenth@tat.physik.uni-tuebingen.de>
To: Gabriel Dos Reis <gdr@integrable-solutions.net>
Cc: Giovanni Bajo <giovannibajo@libero.it>, <gcc-gnats@gcc.gnu.org>,
   <gcc-bugs@gcc.gnu.org>
Subject: Re: c++/10146: [3.4 regression] [new parser] template function lookup
 failure(s)
Date: Wed, 19 Mar 2003 13:47:40 +0100 (CET)

 On 19 Mar 2003, Gabriel Dos Reis wrote:
 
 > Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> writes:
 >
 > | On 19 Mar 2003, Gabriel Dos Reis wrote:
 > |
 > | > Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> writes:
 > | >
 > | > | On Wed, 19 Mar 2003, Giovanni Bajo wrote:
 > | > |
 > | > | >
 > | > | > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
 > | > | > r=10146
 > | > | >
 > | > | > To sum it up:
 > | > | >
 > | > | > >Foo<int>().template foo<U>(u); // does not work
 > | > | > >Foo<int>().template bar<U>(u); // does not work
 > | > | >
 > | > | > These should compile.
 > | > | >
 > | > | > >Foo<int>().foo(u);             // does work ??
 > | > | > >Foo<int>::foo(u);              // does work ??
 > | > | > >Foo<int>().bar(u);             // does work ??
 > | > | >
 > | > | > Yes, because the template parameter of the template member function is
 > | > | > deduced from the call. What's wrong with them?
 > | > |
 > | > | I think foo() and bar() needs to be qualified with the template keyword
 > | > | due to two-stage namelookup. But I may be wrong (dont have a standard
 > | > | to look at).
 > | >
 > | > Two-phase name lookup has nothing to do here.  The Foo<int> part is
 > | > -not- dependent, therefore there need not be any extra "template"
 > | > qualifier.
 > |
 > | Ah, ok - only for Foo<T>:: it would be dependent, yes?
 >
 > Yes.  (Any dependent expression would do also).
 
 If I exchange Foo<int> with Foo<T> only
   Foo<T>().foo<U>(u);
 and
   Foo<T>().bar<U>(u);
 do not work (as expected), but f.i. Foo<T>::foo<U>(u); (while
 Foo<int>::foo<U>(u) is rejected) is ok?
 
 Well, I'll leave it now up to Mark to check&fix all relevant cases
 after 3.3 is out.
 
 Richard.
 
 --
 Richard Guenther <richard.guenther@uni-tuebingen.de>
 WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
 


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

* Re: c++/10146: [3.4 regression] [new parser] template function lookup failure(s)
@ 2003-03-19 12:56 Giovanni Bajo
  0 siblings, 0 replies; 9+ messages in thread
From: Giovanni Bajo @ 2003-03-19 12:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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

The following reply was made to PR c++/10146; it has been noted by GNATS.

From: "Giovanni Bajo" <giovannibajo@libero.it>
To: "Richard Guenther" <rguenth@tat.physik.uni-tuebingen.de>
Cc: <gcc-gnats@gcc.gnu.org>,
	<gcc-bugs@gcc.gnu.org>,
	<nobody@gcc.gnu.org>,
	<gcc-prs@gcc.gnu.org>
Subject: Re: c++/10146: [3.4 regression] [new parser] template function lookup failure(s)
Date: Wed, 19 Mar 2003 13:53:38 +0100

 No, because Foo<int>::foo (and the others) is not a dependent name. §14.2p4
 e p5 explain that the keyword "template" to qualify member templates must be
 used if the postfix expression (obj.member in short) is dependent, and must
 never be used to qualify members which are not templates.
 So, in those three lines basically the template keyword is optional, but not
 required.
 
 Giovanni Bajo
 


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

* Re: c++/10146: [3.4 regression] [new parser] template function lookup failure(s)
@ 2003-03-19 12:46 Gabriel Dos Reis
  0 siblings, 0 replies; 9+ messages in thread
From: Gabriel Dos Reis @ 2003-03-19 12:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10146; it has been noted by GNATS.

From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: Richard Guenther <rguenth@tat.physik.uni-tuebingen.de>
Cc: Giovanni Bajo <giovannibajo@libero.it>, <gcc-gnats@gcc.gnu.org>,
   <gcc-bugs@gcc.gnu.org>
Subject: Re: c++/10146: [3.4 regression] [new parser] template function lookup failure(s)
Date: 19 Mar 2003 13:40:44 +0100

 Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> writes:
 
 | On 19 Mar 2003, Gabriel Dos Reis wrote:
 | 
 | > Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> writes:
 | >
 | > | On Wed, 19 Mar 2003, Giovanni Bajo wrote:
 | > |
 | > | >
 | > | > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
 | > | > r=10146
 | > | >
 | > | > To sum it up:
 | > | >
 | > | > >Foo<int>().template foo<U>(u); // does not work
 | > | > >Foo<int>().template bar<U>(u); // does not work
 | > | >
 | > | > These should compile.
 | > | >
 | > | > >Foo<int>().foo(u);             // does work ??
 | > | > >Foo<int>::foo(u);              // does work ??
 | > | > >Foo<int>().bar(u);             // does work ??
 | > | >
 | > | > Yes, because the template parameter of the template member function is
 | > | > deduced from the call. What's wrong with them?
 | > |
 | > | I think foo() and bar() needs to be qualified with the template keyword
 | > | due to two-stage namelookup. But I may be wrong (dont have a standard
 | > | to look at).
 | >
 | > Two-phase name lookup has nothing to do here.  The Foo<int> part is
 | > -not- dependent, therefore there need not be any extra "template"
 | > qualifier.
 | 
 | Ah, ok - only for Foo<T>:: it would be dependent, yes?
 
 Yes.  (Any dependent expression would do also).
 
 -- Gaby


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

* Re: c++/10146: [3.4 regression] [new parser] template function lookup failure(s)
@ 2003-03-19 12:36 Gabriel Dos Reis
  0 siblings, 0 replies; 9+ messages in thread
From: Gabriel Dos Reis @ 2003-03-19 12:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10146; it has been noted by GNATS.

From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: Richard Guenther <rguenth@tat.physik.uni-tuebingen.de>
Cc: Giovanni Bajo <giovannibajo@libero.it>, gcc-gnats@gcc.gnu.org,
   <gcc-bugs@gcc.gnu.org>
Subject: Re: c++/10146: [3.4 regression] [new parser] template function lookup failure(s)
Date: 19 Mar 2003 13:26:14 +0100

 Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> writes:
 
 | On Wed, 19 Mar 2003, Giovanni Bajo wrote:
 | 
 | >
 | > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
 | > r=10146
 | >
 | > To sum it up:
 | >
 | > >Foo<int>().template foo<U>(u); // does not work
 | > >Foo<int>().template bar<U>(u); // does not work
 | >
 | > These should compile.
 | >
 | > >Foo<int>().foo(u);             // does work ??
 | > >Foo<int>::foo(u);              // does work ??
 | > >Foo<int>().bar(u);             // does work ??
 | >
 | > Yes, because the template parameter of the template member function is
 | > deduced from the call. What's wrong with them?
 | 
 | I think foo() and bar() needs to be qualified with the template keyword
 | due to two-stage namelookup. But I may be wrong (dont have a standard
 | to look at).
 
 Two-phase name lookup has nothing to do here.  The Foo<int> part is
 -not- dependent, therefore there need not be any extra "template"
 qualifier. 
 
 -- Gaby


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

* Re: c++/10146: [3.4 regression] [new parser] template function lookup failure(s)
@ 2003-03-19 12:36 Richard Guenther
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Guenther @ 2003-03-19 12:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10146; it has been noted by GNATS.

From: Richard Guenther <rguenth@tat.physik.uni-tuebingen.de>
To: Gabriel Dos Reis <gdr@integrable-solutions.net>
Cc: Giovanni Bajo <giovannibajo@libero.it>, <gcc-gnats@gcc.gnu.org>,
   <gcc-bugs@gcc.gnu.org>
Subject: Re: c++/10146: [3.4 regression] [new parser] template function lookup
 failure(s)
Date: Wed, 19 Mar 2003 13:32:12 +0100 (CET)

 On 19 Mar 2003, Gabriel Dos Reis wrote:
 
 > Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> writes:
 >
 > | On Wed, 19 Mar 2003, Giovanni Bajo wrote:
 > |
 > | >
 > | > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
 > | > r=10146
 > | >
 > | > To sum it up:
 > | >
 > | > >Foo<int>().template foo<U>(u); // does not work
 > | > >Foo<int>().template bar<U>(u); // does not work
 > | >
 > | > These should compile.
 > | >
 > | > >Foo<int>().foo(u);             // does work ??
 > | > >Foo<int>::foo(u);              // does work ??
 > | > >Foo<int>().bar(u);             // does work ??
 > | >
 > | > Yes, because the template parameter of the template member function is
 > | > deduced from the call. What's wrong with them?
 > |
 > | I think foo() and bar() needs to be qualified with the template keyword
 > | due to two-stage namelookup. But I may be wrong (dont have a standard
 > | to look at).
 >
 > Two-phase name lookup has nothing to do here.  The Foo<int> part is
 > -not- dependent, therefore there need not be any extra "template"
 > qualifier.
 
 Ah, ok - only for Foo<T>:: it would be dependent, yes? So gcc should
 reject or at least warn about the extra "template" here? (gcc3.2 bails
 out with a parse error for Foo<int>::template foo(u);)
 
 Richard.
 
 --
 Richard Guenther <richard.guenther@uni-tuebingen.de>
 WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
 


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

* Re: c++/10146: [3.4 regression] [new parser] template function lookup failure(s)
@ 2003-03-19 12:26 Giovanni Bajo
  0 siblings, 0 replies; 9+ messages in thread
From: Giovanni Bajo @ 2003-03-19 12:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10146; it has been noted by GNATS.

From: "Giovanni Bajo" <giovannibajo@libero.it>
To: <gcc-gnats@gcc.gnu.org>,
	<rguenth@tat.physik.uni-tuebingen.de>,
	<gcc-bugs@gcc.gnu.org>,
	<nobody@gcc.gnu.org>,
	<gcc-prs@gcc.gnu.org>
Cc:  
Subject: Re: c++/10146: [3.4 regression] [new parser] template function lookup failure(s)
Date: Wed, 19 Mar 2003 13:18:09 +0100

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
 r=10146
 
 To sum it up:
 
 >Foo<int>().template foo<U>(u); // does not work
 >Foo<int>().template bar<U>(u); // does not work
 
 These should compile.
 
 >Foo<int>().foo(u);             // does work ??
 >Foo<int>::foo(u);              // does work ??
 >Foo<int>().bar(u);             // does work ??
 
 Yes, because the template parameter of the template member function is
 deduced from the call. What's wrong with them?
 
 Note: I did not verify since I cannot compile GCC 3.4.
 
 Giovanni Bajo
 


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

* c++/10146: [3.4 regression] [new parser] template function lookup failure(s)
@ 2003-03-19  8:56 rguenth
  0 siblings, 0 replies; 9+ messages in thread
From: rguenth @ 2003-03-19  8:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         10146
>Category:       c++
>Synopsis:       [3.4 regression] [new parser] template function lookup failure(s)
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 19 08:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Richard Guenther
>Release:        g++-3.4 (GCC) 3.4 20030313 (experimental)
>Organization:
>Environment:

>Description:
In the following testcase the marked lines fail/work even if they should/should not (the former being the problem for me). One should carefuly check the standard if any of the working one should be rejected.

The error message from compiling the testcase is

bellatrix:~/src/tests$ g++-3.4 -c temp.cpp 
temp.cpp: In member function `void Bar<T>::operator()(const U&) [with U = int, 
   T = char]':
temp.cpp:32:   instantiated from here
temp.cpp:14: error: no matching function for call to `Foo<int>::foo(const int&)
   '
temp.cpp:15: error: no matching function for call to `Foo<int>::foo(const int&)
   '
temp.cpp:16: error: no matching function for call to `Foo<int>::foo(const int&)
   '
temp.cpp:32:   instantiated from here
temp.cpp:18: error: no matching function for call to `Foo<int>::bar(const int&)
   '
temp.cpp:19: error: no matching function for call to `Foo<int>::bar(const int&)
   '


Testcase:

template <class T>
struct Foo {
        template <class U>
        static void foo(const U&);
        template <class U>
        void bar(const U&);
};

template <class T>
struct Bar {
        template <class U>
        void operator()(const U&u)
        {
                Foo<int>().foo<U>(u);          // does not work (ok)
                Foo<int>::foo<U>(u);           // does not work (ok)
                Foo<int>().template foo<U>(u); // does not work
                Foo<int>::template foo<U>(u);  // does work
                Foo<int>().bar<U>(u);          // does not work (ok)
                Foo<int>().template bar<U>(u); // does not work
                Foo<int>().foo(u);             // does work ??
                Foo<int>::foo(u);              // does work ??
                Foo<int>().template foo(u);    // does work
                Foo<int>::template foo(u);     // does work
                Foo<int>().bar(u);             // does work ??
                Foo<int>().template bar(u);    // does work
        }
};

void foo()
{
        int i;
        Bar<char>()(i);
}
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2003-03-20  2:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-19 12:26 c++/10146: [3.4 regression] [new parser] template function lookup failure(s) Richard Guenther
  -- strict thread matches above, loose matches on Subject: below --
2003-03-20  2:05 bangerth
2003-03-19 12:56 Giovanni Bajo
2003-03-19 12:56 Richard Guenther
2003-03-19 12:46 Gabriel Dos Reis
2003-03-19 12:36 Gabriel Dos Reis
2003-03-19 12:36 Richard Guenther
2003-03-19 12:26 Giovanni Bajo
2003-03-19  8:56 rguenth

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