public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/9660: use of template keyword to specify templated method cause ICE
@ 2003-02-11 10:36 maudouy
0 siblings, 0 replies; 4+ messages in thread
From: maudouy @ 2003-02-11 10:36 UTC (permalink / raw)
To: gcc-gnats
>Number: 9660
>Category: c++
>Synopsis: use of template keyword to specify templated method cause ICE
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Tue Feb 11 10:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: maudouy@amadeus.net
>Release: gcc 3.0.1
>Organization:
>Environment:
HP-UX B.11.11
>Description:
the use of "template" keyword for template specialisation appearing in a postfix expression (ISO 14882 14.2.4) is causing an internal compiler error.
the attached file, compiled without options, reproduce the ICE.
>How-To-Repeat:
>Fix:
an easy workaround is not to use the template keyword, it works in this case. but when using other compilers (like aCC on HP-UX) it is necessary.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="templateBug.cpp"
Content-Disposition: inline; filename="templateBug.cpp"
namespace TOTO {
template <typename ObjectType,
typename FirstArgumentType,
typename SecondArgumentType>
ObjectType&
create(FirstArgumentType & firstArg,
SecondArgumentType & secondArg)
{
ObjectType & ref = *(new ObjectType(firstArg, secondArg));
return ref;
}
}
namespace FOO {
class A {
public:
int x_;
int y_;
A(int& x, int& y):x_(x),y_(y) {}
};
class B {
public:
A& getA(int a, int b)
{
A& anA = TOTO::template create<A>(a,b);
return anA;
}
};
}
int main() {
FOO::B b;
FOO::A& anA = b.getA(2,3);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/9660: use of template keyword to specify templated method cause ICE
@ 2003-02-14 21:01 bangerth
0 siblings, 0 replies; 4+ messages in thread
From: bangerth @ 2003-02-14 21:01 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, maudouy, nobody
Synopsis: use of template keyword to specify templated method cause ICE
State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Fri Feb 14 21:01:03 2003
State-Changed-Why:
ICE confirmed with 3.2.2. 3.3 accepts the code, and
3.4 issues this message:
tmp/g> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In member function `FOO::A& FOO::B::getA(int, int)':
x.cc:28: error: `template' (as a disambiguator) is only allowed within
templates
So it's fixed.
W.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9660
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/9660: use of template keyword to specify templated method cause ICE
@ 2003-02-11 11:06 MAudouy
0 siblings, 0 replies; 4+ messages in thread
From: MAudouy @ 2003-02-11 11:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/9660; it has been noted by GNATS.
From: MAudouy@amadeus.net
To: gdr@integrable-solutions.net
Cc: gcc-gnats@gcc.gnu.org, gdr@integrable-solutions.net
Subject: Re: c++/9660: use of template keyword to specify templated method cause ICE
Date: Tue, 11 Feb 2003 11:02:15 +0000
You are right, I have not noticed this peculiarity (14.2/5) before.
this PR should be reclassified as ice-on-illegal-code then
Marc Audouy
From: Gabriel Dos Reis <gdr@integrable-solutions.net>
@integrable-solutions.net on 11/02/2003 11:53 CET
Sent by: gdr@integrable-solutions.net
To: maudouy@amadeus.net
cc: gcc-gnats@gcc.gnu.org
Subjec Re: c++/9660: use of template
t: keyword to specify templated
method cause ICE
maudouy@amadeus.net writes:
| >Number: 9660
| >Category: c++
| >Synopsis: use of template keyword to specify templated method
cause ICE
| >Confidential: no
| >Severity: serious
| >Priority: medium
| >Responsible: unassigned
| >State: open
| >Class: ice-on-legal-code
I believe your program is ill-formed, and I would suggest this PR be
reclassified as ice-on-illegal-code.
14.2/5
If a name prefixed by the keyword template is not the name of a
member template, the program is ill-formed.
[...]
| >Fix:
| an easy workaround is not to use the template keyword, it works in this
case. but when using other compilers (like aCC on HP-UX) it is necessary.
Those compilers are in error, AFAICT.
[...]
| class B {
| public:
| A& getA(int a, int b)
| {
| A& anA = TOTO::template create<A>(a,b);
^^^^^^^^^^^^^^
That is not valid; see 14.2/5 quoted above.
-- Gaby
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/9660: use of template keyword to specify templated method cause ICE
@ 2003-02-11 10:56 Gabriel Dos Reis
0 siblings, 0 replies; 4+ messages in thread
From: Gabriel Dos Reis @ 2003-02-11 10:56 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/9660; it has been noted by GNATS.
From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: maudouy@amadeus.net
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/9660: use of template keyword to specify templated method cause ICE
Date: 11 Feb 2003 11:53:23 +0100
maudouy@amadeus.net writes:
| >Number: 9660
| >Category: c++
| >Synopsis: use of template keyword to specify templated method cause ICE
| >Confidential: no
| >Severity: serious
| >Priority: medium
| >Responsible: unassigned
| >State: open
| >Class: ice-on-legal-code
I believe your program is ill-formed, and I would suggest this PR be
reclassified as ice-on-illegal-code.
14.2/5
If a name prefixed by the keyword template is not the name of a
member template, the program is ill-formed.
[...]
| >Fix:
| an easy workaround is not to use the template keyword, it works in this case. but when using other compilers (like aCC on HP-UX) it is necessary.
Those compilers are in error, AFAICT.
[...]
| class B {
| public:
| A& getA(int a, int b)
| {
| A& anA = TOTO::template create<A>(a,b);
^^^^^^^^^^^^^^
That is not valid; see 14.2/5 quoted above.
-- Gaby
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-02-14 21:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-11 10:36 c++/9660: use of template keyword to specify templated method cause ICE maudouy
2003-02-11 10:56 Gabriel Dos Reis
2003-02-11 11:06 MAudouy
2003-02-14 21:01 bangerth
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).