public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14008] New: Confusing diagnostic when ommitting a template parameter
@ 2004-02-03 20:29 reichelt at gcc dot gnu dot org
2004-02-03 20:33 ` [Bug c++/14008] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-02-03 20:29 UTC (permalink / raw)
To: gcc-bugs
Here are two invalid code snippets where gcc gives misleading diagnostic:
=================================================
namespace N
{
template<int> struct A {};
}
struct B
{
N::A a;
};
=================================================
With mainline I get
bug1.cc:8: error: using-declaration for non-member at class scope
bug1.cc:8: error: expected `;' before "a"
but I fail to see a using declaration in the code.
If I write "typename N::A a;" instead and make "struct B" a template
like so
=================================================
namespace N
{
template<int> struct A {};
}
template<int> struct B
{
typename N::A a;
};
=================================================
I get
bug2.cc:8: error: no class template named `A' in `N'
bug2.cc:8: error: ISO C++ forbids declaration of `a' with no type
which is equally confusing, since 'A' *is* a class template in 'N'.
--
Summary: Confusing diagnostic when ommitting a template parameter
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Keywords: diagnostic
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=14008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/14008] [3.4/3.5 Regression] Confusing diagnostic when ommitting a template parameter
2004-02-03 20:29 [Bug c++/14008] New: Confusing diagnostic when ommitting a template parameter reichelt at gcc dot gnu dot org
@ 2004-02-03 20:33 ` pinskia at gcc dot gnu dot org
2004-02-04 3:25 ` giovannibajo at libero dot it
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-03 20:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-02-03 20:33 -------
3.3.3 gives better diagnostic for the first case:
pr14008.cc:8: error: invalid use of template-name 'N::A' in a declarator
pr14008.cc:8: error: syntax error before `;' token
The second case is not a regression, it is accepted by 3.3.3.
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-02-03 20:33:51
date| |
Summary|Confusing diagnostic when |[3.4/3.5 Regression]
|ommitting a template |Confusing diagnostic when
|parameter |ommitting a template
| |parameter
Target Milestone|--- |3.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/14008] [3.4/3.5 Regression] Confusing diagnostic when ommitting a template parameter
2004-02-03 20:29 [Bug c++/14008] New: Confusing diagnostic when ommitting a template parameter reichelt at gcc dot gnu dot org
2004-02-03 20:33 ` [Bug c++/14008] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-02-04 3:25 ` giovannibajo at libero dot it
2004-02-05 1:17 ` giovannibajo at libero dot it
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: giovannibajo at libero dot it @ 2004-02-04 3:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-02-04 03:25 -------
Mine, I have a patch almost ready for this.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |giovannibajo at libero dot
|dot org |it
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/14008] [3.4/3.5 Regression] Confusing diagnostic when ommitting a template parameter
2004-02-03 20:29 [Bug c++/14008] New: Confusing diagnostic when ommitting a template parameter reichelt at gcc dot gnu dot org
2004-02-03 20:33 ` [Bug c++/14008] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-02-04 3:25 ` giovannibajo at libero dot it
@ 2004-02-05 1:17 ` giovannibajo at libero dot it
2004-02-05 1:20 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: giovannibajo at libero dot it @ 2004-02-05 1:17 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-02-05 01:17 -------
Patch here:
http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00361.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/14008] [3.4/3.5 Regression] Confusing diagnostic when ommitting a template parameter
2004-02-03 20:29 [Bug c++/14008] New: Confusing diagnostic when ommitting a template parameter reichelt at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-02-05 1:17 ` giovannibajo at libero dot it
@ 2004-02-05 1:20 ` pinskia at gcc dot gnu dot org
2004-02-05 7:07 ` steven at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-05 1:20 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |minor
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/14008] [3.4/3.5 Regression] Confusing diagnostic when ommitting a template parameter
2004-02-03 20:29 [Bug c++/14008] New: Confusing diagnostic when ommitting a template parameter reichelt at gcc dot gnu dot org
` (3 preceding siblings ...)
2004-02-05 1:20 ` pinskia at gcc dot gnu dot org
@ 2004-02-05 7:07 ` steven at gcc dot gnu dot org
2004-02-05 16:49 ` cvs-commit at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-02-05 7:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-02-05 07:07 -------
Too risky for 3.4 according to Mark, see
http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00381.html
Perhaps it can be backported from mainline in the future.
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.4.0 |3.4.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/14008] [3.4/3.5 Regression] Confusing diagnostic when ommitting a template parameter
2004-02-03 20:29 [Bug c++/14008] New: Confusing diagnostic when ommitting a template parameter reichelt at gcc dot gnu dot org
` (4 preceding siblings ...)
2004-02-05 7:07 ` steven at gcc dot gnu dot org
@ 2004-02-05 16:49 ` cvs-commit at gcc dot gnu dot org
2004-02-05 16:51 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-05 16:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-02-05 16:49 -------
Subject: Bug 14008
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: giovannibajo@gcc.gnu.org 2004-02-05 16:48:55
Modified files:
gcc/cp : ChangeLog parser.c
Log message:
PR c++/14008
* parser.c (cp_parser_diagnose_invalid_typename): Removed parsing
code, only emits the diagnostic now. Added lookup of the identifier
and support for qualified ids.
(cp_parser_parse_and_diagnose_invalid_type_name): New function.
Parse an (invalid) type name as id-expression within a declarator.
(cp_parser_simple_declaration): Use it.
(cp_parser_member_declaration): Likewise.
(cp_parser_make_typename_type): New function. Handle errors through
cp_parser_diagnose_invalid_typename.
(cp_parser_elaborated_type_specifier): Use it.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3937&r2=1.3938
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.168&r2=1.169
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/14008] [3.4/3.5 Regression] Confusing diagnostic when ommitting a template parameter
2004-02-03 20:29 [Bug c++/14008] New: Confusing diagnostic when ommitting a template parameter reichelt at gcc dot gnu dot org
` (5 preceding siblings ...)
2004-02-05 16:49 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-05 16:51 ` cvs-commit at gcc dot gnu dot org
2004-02-05 16:55 ` giovannibajo at libero dot it
2004-06-12 21:49 ` [Bug c++/14008] [3.4 Regression] Confusing diagnostic when omitting " mmitchel at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-05 16:51 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-02-05 16:51 -------
Subject: Bug 14008
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: giovannibajo@gcc.gnu.org 2004-02-05 16:50:57
Modified files:
gcc/testsuite : ChangeLog
gcc/testsuite/g++.dg/parse: crash11.C
Added files:
gcc/testsuite/g++.dg/parse: error15.C
Log message:
PR c++/14008
* g++.dg/parse/error15.C: New test.
* g++.dg/parse/crash11.C: Update dg-error mark.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3472&r2=1.3473
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/error15.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/crash11.C.diff?cvsroot=gcc&r1=1.2&r2=1.3
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/14008] [3.4/3.5 Regression] Confusing diagnostic when ommitting a template parameter
2004-02-03 20:29 [Bug c++/14008] New: Confusing diagnostic when ommitting a template parameter reichelt at gcc dot gnu dot org
` (6 preceding siblings ...)
2004-02-05 16:51 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-05 16:55 ` giovannibajo at libero dot it
2004-06-12 21:49 ` [Bug c++/14008] [3.4 Regression] Confusing diagnostic when omitting " mmitchel at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: giovannibajo at libero dot it @ 2004-02-05 16:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-02-05 16:55 -------
Fixed in 3.5.0.
It looks like the only 3.4 regression is the wrong message about the using
declaration. The point is that the parser thinks that N::A is an access-
declaration and in fact then expectes a ";" before "a". Now, if I changed the
wording to something like:
error: access-declaration for non-member "N::A" at class scope.
would it be still a regression? Of course it's much inferior than what we get
in 3.5.0, but it would be a non-intrusive patch.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14008
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/14008] [3.4 Regression] Confusing diagnostic when omitting a template parameter
2004-02-03 20:29 [Bug c++/14008] New: Confusing diagnostic when ommitting a template parameter reichelt at gcc dot gnu dot org
` (7 preceding siblings ...)
2004-02-05 16:55 ` giovannibajo at libero dot it
@ 2004-06-12 21:49 ` mmitchel at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-06-12 21:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mmitchel at gcc dot gnu dot org 2004-06-12 21:49 -------
Let's not bother with this for 3.4.x.
Fixed in 3.5.0.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|3.4.1 |3.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14008
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-06-12 21:49 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-03 20:29 [Bug c++/14008] New: Confusing diagnostic when ommitting a template parameter reichelt at gcc dot gnu dot org
2004-02-03 20:33 ` [Bug c++/14008] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-02-04 3:25 ` giovannibajo at libero dot it
2004-02-05 1:17 ` giovannibajo at libero dot it
2004-02-05 1:20 ` pinskia at gcc dot gnu dot org
2004-02-05 7:07 ` steven at gcc dot gnu dot org
2004-02-05 16:49 ` cvs-commit at gcc dot gnu dot org
2004-02-05 16:51 ` cvs-commit at gcc dot gnu dot org
2004-02-05 16:55 ` giovannibajo at libero dot it
2004-06-12 21:49 ` [Bug c++/14008] [3.4 Regression] Confusing diagnostic when omitting " mmitchel 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).