public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19501] New: Redundant "template" keyword rejected
@ 2005-01-18 9:39 reichelt at gcc dot gnu dot org
2005-01-18 14:39 ` [Bug c++/19501] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 3+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-01-18 9:39 UTC (permalink / raw)
To: gcc-bugs
The following valid code snippet is rejected since at least gcc 2.95.3:
===================================
template<typename> struct A
{
template<int> struct B;
friend struct A::template B<0>;
};
===================================
The error message on mainline reads:
bugA.cc:4: error: expected identifier before ';' token
bugA.cc:4: error: friend declaration does not name a class or function
GCC also rejects
===================================
template<typename> struct A
{
template<int> struct B {};
A::template B<0> b;
};
===================================
with
bugB.cc:4: error: ISO C++ forbids declaration of 'B' with no type
bugB.cc:4: error: template-id 'B<0>' used as a declarator
bugB.cc:4: error: expected ';' before 'b'
Removing the redundant "template" keyword makes the code compile in both cases.
--
Summary: Redundant "template" keyword rejected
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: rejects-valid, monitored
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reichelt at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19501
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/19501] Redundant "template" keyword rejected
2005-01-18 9:39 [Bug c++/19501] New: Redundant "template" keyword rejected reichelt at gcc dot gnu dot org
@ 2005-01-18 14:39 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-18 14:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-18 14:35 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-01-18 14:35:30
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19501
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/19501] Redundant "template" keyword rejected
[not found] <bug-19501-4@http.gcc.gnu.org/bugzilla/>
@ 2021-07-24 1:48 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-24 1:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19501
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For the first case, GCC 11 accepts it finally.
For the second case, GCC 11 accepts it only for -std=c++20 .
clang accepts both cases even for -std=c++98.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-24 1:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-18 9:39 [Bug c++/19501] New: Redundant "template" keyword rejected reichelt at gcc dot gnu dot org
2005-01-18 14:39 ` [Bug c++/19501] " pinskia at gcc dot gnu dot org
[not found] <bug-19501-4@http.gcc.gnu.org/bugzilla/>
2021-07-24 1:48 ` pinskia at gcc dot gnu.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).