public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/3012: c++ bug
@ 2001-06-01 3:46 Artem Khodush
0 siblings, 0 replies; 3+ messages in thread
From: Artem Khodush @ 2001-06-01 3:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/3012; it has been noted by GNATS.
From: "Artem Khodush" <artem@duma.gov.ru>
To: "Robert B. Lowrie" <lowrie@belle.lanl.gov>, <gcc-gnats@gcc.gnu.org>
Cc: <furboo@cybermesa.com>, <gcc-bugs@gcc.gnu.org>
Subject: Re: c++/3012: c++ bug
Date: Fri, 1 Jun 2001 14:28:40 +0400
Robert B. Lowrie wrote:
> If a templated member function `foo' of even a non-templated class
> `A' is called within a templated class `B' with the syntax
> foo<double>(), the compiler gives a syntax error.
> // when B is a template, compile fails on this line:
> a.foo<double>();
Not a bug.
According to c++ grammar rules, '<' here means less-then operator.
You should write a.template foo<double>().
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c++/3012: c++ bug
@ 2001-06-01 18:26 Gabriel Dos Reis
0 siblings, 0 replies; 3+ messages in thread
From: Gabriel Dos Reis @ 2001-06-01 18:26 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/3012; it has been noted by GNATS.
From: Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
To: "Artem Khodush" <artem@duma.gov.ru>
Cc: "Robert B. Lowrie" <lowrie@belle.lanl.gov>, <gcc-gnats@gcc.gnu.org>,
<furboo@cybermesa.com>, <gcc-bugs@gcc.gnu.org>
Subject: Re: c++/3012: c++ bug
Date: 02 Jun 2001 03:12:21 +0200
"Artem Khodush" <artem@duma.gov.ru> writes:
| Robert B. Lowrie wrote:
| > If a templated member function `foo' of even a non-templated class
| > `A' is called within a templated class `B' with the syntax
| > foo<double>(), the compiler gives a syntax error.
|
| > // when B is a template, compile fails on this line:
| > a.foo<double>();
|
| Not a bug.
This IS a known bug in the parser.
-- Gaby
^ permalink raw reply [flat|nested] 3+ messages in thread
* c++/3012: c++ bug
@ 2001-05-31 8:26 Robert B. Lowrie
0 siblings, 0 replies; 3+ messages in thread
From: Robert B. Lowrie @ 2001-05-31 8:26 UTC (permalink / raw)
To: gcc-gnats; +Cc: furboo
>Number: 3012
>Category: c++
>Synopsis: templated member function fails within templated class
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Thu May 31 08:26:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Robert B. Lowrie
>Release: 3.0 20010528 (prerelease)
>Organization:
>Environment:
System: Linux belle 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-20010528/configure --prefix=/usr/local/gcc-20010528
>Description:
If a templated member function `foo' of even a non-templated class
`A' is called within a templated class `B' with the syntax
foo<double>(), the compiler gives a syntax error.
>How-To-Repeat:
// Here is a code snippet that repeats the problem:
#include <iostream>
// Defining B_IS_A_TEMPLATE makes class B a template and this code fails
// to compile. If not defined (comment next line out), the code compiles
// and runs successfully.
#define B_IS_A_TEMPLATE
class A
{
public:
template <class T>
void foo() const
{
T data;
std::cout << data << std::endl;
}
};
#ifdef B_IS_A_TEMPLATE
template <class T>
#endif
class B
{
public:
void bar(const A& a) const
{
// when B is a template, compile fails on this line:
a.foo<double>();
}
};
int main()
{
A a;
#ifdef B_IS_A_TEMPLATE
B<int> b;
#else
B b;
#endif
b.bar(a);
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-06-01 18:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-01 3:46 c++/3012: c++ bug Artem Khodush
-- strict thread matches above, loose matches on Subject: below --
2001-06-01 18:26 Gabriel Dos Reis
2001-05-31 8:26 Robert B. Lowrie
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).