public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19253] New: [3.4/4.0 regression] bad error message / ICE for invalid template parameter
@ 2005-01-04 14:31 reichelt at gcc dot gnu dot org
  2005-01-04 15:47 ` [Bug c++/19253] " pinskia at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-01-04 14:31 UTC (permalink / raw)
  To: gcc-bugs

The following invalid testcase causes an ICE on mainline:

=================================
namespace N {}

template<typename> struct A
{
    A<typename N::X<int> > a;
};
=================================

  bug.cc:5: error: 'X' in namespace 'N' does not name a type
  bug.cc:5: internal compiler error: in make_typename_type, at cp/decl.c:2685
  Please submit a full bug report, [etc.]

Mark, the ICE was introduced by your patch for PR18738:
http://gcc.gnu.org/ml/gcc-cvs/2004-12/msg00592.html

Before we got a regression w.r.t. the error message.
Right before the ICE we had:

  bug.cc:5: error: no class template named `X' in `N'
  bug.cc:5: error: no class template named `X' in `N'
  bug.cc:5: error: missing `>' to terminate the template argument list
  bug.cc:5: error: template argument 1 is invalid
  bug.cc:5: error: no class template named `X' in `N'
  bug.cc:5: error: no class template named `X' in `N'
  bug.cc:5: error: missing `>' to terminate the template argument list
  bug.cc:5: error: template argument 1 is invalid
  bug.cc:5: error: no class template named `X' in `N'
  bug.cc:5: error: no class template named `X' in `N'
  bug.cc:5: error: missing `>' to terminate the template argument list
  bug.cc:5: error: template argument 1 is invalid
  bug.cc:5: error: no class template named `X' in `N'
  bug.cc:5: error: no class template named `X' in `N'
  bug.cc:5: error: missing `>' to terminate the template argument list
  bug.cc:5: error: template argument 1 is invalid
  bug.cc:5: error: `A< <template-parameter-1-1> >' is not a template
  bug.cc:5: error: no class template named `X' in `N'
  bug.cc:5: error: no class template named `X' in `N'
  bug.cc:5: error: expected `(' before '<' token
  bug.cc:5: error: expected primary-expression before "int"
  bug.cc:5: error: expected `>' before "int"
  bug.cc:5: error: missing `>' to terminate the template argument list
  bug.cc:5: error: expected unqualified-id before '>' token

(This is probably a new record, 10 times the same message!)

Alexandre, this was introduced by your patch for PR18757:
http://gcc.gnu.org/ml/gcc-cvs/2004-12/msg00382.html

Before we only had the following error message:

  bug.cc:5: error: 'X' in namespace 'N' does not name a type
  bug.cc:5: error: no class template named 'X' in 'N'
  bug.cc:5: error: missing '>' to terminate the template argument list
  bug.cc:5: error: template argument 1 is invalid
  bug.cc:5: error: expected unqualified-id before '>' token

which is much better.

While the ICE is only present on mainline (because the patch for
PR18738 has not been backported yet) the error message regression
also affects the 3.4 branch.

-- 
           Summary: [3.4/4.0 regression] bad error message / ICE for invalid
                    template parameter
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, error-recovery, diagnostic
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: aoliva at gcc dot gnu dot org,gcc-bugs at gcc dot gnu
                    dot org,mmitchel at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19253


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

* [Bug c++/19253] [3.4/4.0 regression] bad error message / ICE for invalid template parameter
  2005-01-04 14:31 [Bug c++/19253] New: [3.4/4.0 regression] bad error message / ICE for invalid template parameter reichelt at gcc dot gnu dot org
@ 2005-01-04 15:47 ` pinskia at gcc dot gnu dot org
  2005-01-04 16:45 ` reichelt at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-04 15:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-04 15:46 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-01-04 15:46:59
               date|                            |
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19253


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

* [Bug c++/19253] [3.4/4.0 regression] bad error message / ICE for invalid template parameter
  2005-01-04 14:31 [Bug c++/19253] New: [3.4/4.0 regression] bad error message / ICE for invalid template parameter reichelt at gcc dot gnu dot org
  2005-01-04 15:47 ` [Bug c++/19253] " pinskia at gcc dot gnu dot org
@ 2005-01-04 16:45 ` reichelt at gcc dot gnu dot org
  2005-01-06 15:36 ` nathan at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-01-04 16:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-01-04 16:45 -------
The following example is even worse:

=================================
namespace N { struct X; }

template<typename> struct A
{
    A<typename N::X x> a;
};
=================================

Mainline crashes without emitting an error message first.


gcc 3.4.3 and 3.4.4-pre issue the same error messages as above.
This is bogus, since N::X is not a template (neither in line 1
nor in line 5). Well, they even error out on the valid code snippet

=================================
namespace N { struct X; }

template<typename> struct A {};

template<typename> struct B
{
    A<typename N::X> a;
};
=================================

Mainline accepts the code thanks to Mark's patch for PR18738.
IMHO the right thing to do is to fix the ICE on mainline and backport
the fix for PR18738 and the fix for the ICE to the 3.4 branch.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |18738


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19253


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

* [Bug c++/19253] [3.4/4.0 regression] bad error message / ICE for invalid template parameter
  2005-01-04 14:31 [Bug c++/19253] New: [3.4/4.0 regression] bad error message / ICE for invalid template parameter reichelt at gcc dot gnu dot org
  2005-01-04 15:47 ` [Bug c++/19253] " pinskia at gcc dot gnu dot org
  2005-01-04 16:45 ` reichelt at gcc dot gnu dot org
@ 2005-01-06 15:36 ` nathan at gcc dot gnu dot org
  2005-01-29  2:08 ` cvs-commit at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: nathan at gcc dot gnu dot org @ 2005-01-06 15:36 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |nathan at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-01-04 15:46:59         |2005-01-06 15:36:18
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19253


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

* [Bug c++/19253] [3.4/4.0 regression] bad error message / ICE for invalid template parameter
  2005-01-04 14:31 [Bug c++/19253] New: [3.4/4.0 regression] bad error message / ICE for invalid template parameter reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-01-06 15:36 ` nathan at gcc dot gnu dot org
@ 2005-01-29  2:08 ` cvs-commit at gcc dot gnu dot org
  2005-01-29  2:10 ` [Bug c++/19253] [3.4 " mmitchel at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-01-29  2:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-01-29 02:07 -------
Subject: Bug 19253

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2005-01-29 02:07:19

Modified files:
	gcc/cp         : ChangeLog parser.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: crash33.C 

Log message:
	PR c++/19253
	* parser.c (cp_parser_diagnose_invalid_type_name): Commit to
	tentative parses.
	
	PR c++/19253
	* g++.dg/template/crash33.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4600&r2=1.4601
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.303&r2=1.304
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4952&r2=1.4953
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/crash33.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19253


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

* [Bug c++/19253] [3.4 regression] bad error message / ICE for invalid template parameter
  2005-01-04 14:31 [Bug c++/19253] New: [3.4/4.0 regression] bad error message / ICE for invalid template parameter reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-01-29  2:08 ` cvs-commit at gcc dot gnu dot org
@ 2005-01-29  2:10 ` mmitchel at gcc dot gnu dot org
  2005-02-11 21:41 ` [Bug c++/19253] [3.4/4.0 " reichelt at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-01-29  2:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-01-29 02:10 -------
Fixed in GCC 4.0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[3.4/4.0 regression] bad    |[3.4 regression] bad error
                   |error message / ICE for     |message / ICE for invalid
                   |invalid template parameter  |template parameter
   Target Milestone|4.0.0                       |3.4.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19253


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

* [Bug c++/19253] [3.4/4.0 regression] bad error message / ICE for invalid template parameter
  2005-01-04 14:31 [Bug c++/19253] New: [3.4/4.0 regression] bad error message / ICE for invalid template parameter reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-01-29  2:10 ` [Bug c++/19253] [3.4 " mmitchel at gcc dot gnu dot org
@ 2005-02-11 21:41 ` reichelt at gcc dot gnu dot org
  2005-02-11 21:45 ` reichelt at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-02-11 21:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-02-11 17:12 -------
Mark, the first code snippet in comment #3 still crashes on mainline.
So this is not yet fixed on mainline.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[3.4 regression] bad error  |[3.4/4.0 regression] bad
                   |message / ICE for invalid   |error message / ICE for
                   |template parameter          |invalid template parameter


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19253


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

* [Bug c++/19253] [3.4/4.0 regression] bad error message / ICE for invalid template parameter
  2005-01-04 14:31 [Bug c++/19253] New: [3.4/4.0 regression] bad error message / ICE for invalid template parameter reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-02-11 21:41 ` [Bug c++/19253] [3.4/4.0 " reichelt at gcc dot gnu dot org
@ 2005-02-11 21:45 ` reichelt at gcc dot gnu dot org
  2005-02-11 22:50 ` bangerth at dealii dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-02-11 21:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-02-11 17:13 -------
Sorry, I meant comment #2, of course.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19253


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

* [Bug c++/19253] [3.4/4.0 regression] bad error message / ICE for invalid template parameter
  2005-01-04 14:31 [Bug c++/19253] New: [3.4/4.0 regression] bad error message / ICE for invalid template parameter reichelt at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2005-02-11 21:45 ` reichelt at gcc dot gnu dot org
@ 2005-02-11 22:50 ` bangerth at dealii dot org
  2005-02-14 20:21 ` reichelt at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bangerth at dealii dot org @ 2005-02-11 22:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2005-02-11 17:50 -------
Volker, you seem to be on a quest to make gcc accept without crashing even  
the most obnoxious wrong code snippets without ICEing. How do you generate 
all these snippets? 
 
(As a sidenote, even if they are technically regressions, I don't consider 
such artificial codes really important to fix. There are more important 
things, and we get this right for gcc 4.6.2, that'll be ok with me as well :-) 
 
W. 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19253


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

* [Bug c++/19253] [3.4/4.0 regression] bad error message / ICE for invalid template parameter
  2005-01-04 14:31 [Bug c++/19253] New: [3.4/4.0 regression] bad error message / ICE for invalid template parameter reichelt at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2005-02-11 22:50 ` bangerth at dealii dot org
@ 2005-02-14 20:21 ` reichelt at gcc dot gnu dot org
  2005-05-19 17:48 ` [Bug c++/19253] [3.4/4.0/4.1 " mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-02-14 20:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-02-14 15:58 -------
> Volker, you seem to be on a quest to make gcc accept without crashing even
> the most obnoxious wrong code snippets without ICEing.

I wouldn't say that they're "obnoxious" ;-)
These code snippets are usually only one bug away from valid code.

> How do you generate all these snippets?

By sheer determination. I pick some topic like pointers-to-members or
destructors for example and try to find some bugs. Over time you get
a good feeling for GCC's weaknesses (templates for example). Well,
okay, maybe those code snippets are "obnoxious".

> (As a sidenote, even if they are technically regressions, I don't consider
> such artificial codes really important to fix. There are more important
> things, and we get this right for gcc 4.6.2, that'll be ok with me as well :-)

Of course they are less important than wrong-code, ice-on-valid and
rejects-valid bugs. OTOH, it's a matter of QoI. The sheer number of
such little bugs makes them a real problem. Two examples:

* If you use the compiler in education, you want a bullet-proof compiler
  and not a compiler that falls flat on its face when being confronted
  with silly mistakes.
* Many people learn programming languages by throwing code at the compiler
  rather than checking it out first in the standard (which does make sense
  given the size and readability of the standard). If it doesn't compile
  one can still look what went wrong (given a good error message).
  A compiler that accepts invalid code will generate bug reports
  "this used to compile with gcc x.y.z!" one release later.
  A compiler that just crashes without sensible error messages isn't
  very helpful at least.

In order to make GCC the best compiler around, we should get rid of
these little pesky bugs.

The new C++ parser has been merged over two years ago. Most of the dust
should have settled by now. So to me the time seems to be right to do
some clean-up.

> W.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19253


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

* [Bug c++/19253] [3.4/4.0/4.1 regression] bad error message / ICE for invalid template parameter
  2005-01-04 14:31 [Bug c++/19253] New: [3.4/4.0 regression] bad error message / ICE for invalid template parameter reichelt at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2005-02-14 20:21 ` reichelt at gcc dot gnu dot org
@ 2005-05-19 17:48 ` mmitchel at gcc dot gnu dot org
  2005-07-22 21:18 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-05-19 17:48 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.4                       |3.4.5


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19253


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

* [Bug c++/19253] [3.4/4.0/4.1 regression] bad error message / ICE for invalid template parameter
  2005-01-04 14:31 [Bug c++/19253] New: [3.4/4.0 regression] bad error message / ICE for invalid template parameter reichelt at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2005-05-19 17:48 ` [Bug c++/19253] [3.4/4.0/4.1 " mmitchel at gcc dot gnu dot org
@ 2005-07-22 21:18 ` pinskia at gcc dot gnu dot org
  2005-09-06 15:27 ` reichelt at gcc dot gnu dot org
  2005-09-27 16:24 ` mmitchel at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-22 21:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-22 21:13 -------
Moving to 4.0.2 pre Mark.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.5                       |4.0.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19253


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

* [Bug c++/19253] [3.4/4.0/4.1 regression] bad error message / ICE for invalid template parameter
  2005-01-04 14:31 [Bug c++/19253] New: [3.4/4.0 regression] bad error message / ICE for invalid template parameter reichelt at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2005-07-22 21:18 ` pinskia at gcc dot gnu dot org
@ 2005-09-06 15:27 ` reichelt at gcc dot gnu dot org
  2005-09-27 16:24 ` mmitchel at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-09-06 15:27 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 19253 depends on bug 18738, which changed state.

Bug 18738 Summary: [3.4 Regression] typename not allowed with non-dependent qualified name
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18738

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19253


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

* [Bug c++/19253] [3.4/4.0/4.1 regression] bad error message / ICE for invalid template parameter
  2005-01-04 14:31 [Bug c++/19253] New: [3.4/4.0 regression] bad error message / ICE for invalid template parameter reichelt at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2005-09-06 15:27 ` reichelt at gcc dot gnu dot org
@ 2005-09-27 16:24 ` mmitchel at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:24 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19253


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

end of thread, other threads:[~2005-09-27 16:24 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-04 14:31 [Bug c++/19253] New: [3.4/4.0 regression] bad error message / ICE for invalid template parameter reichelt at gcc dot gnu dot org
2005-01-04 15:47 ` [Bug c++/19253] " pinskia at gcc dot gnu dot org
2005-01-04 16:45 ` reichelt at gcc dot gnu dot org
2005-01-06 15:36 ` nathan at gcc dot gnu dot org
2005-01-29  2:08 ` cvs-commit at gcc dot gnu dot org
2005-01-29  2:10 ` [Bug c++/19253] [3.4 " mmitchel at gcc dot gnu dot org
2005-02-11 21:41 ` [Bug c++/19253] [3.4/4.0 " reichelt at gcc dot gnu dot org
2005-02-11 21:45 ` reichelt at gcc dot gnu dot org
2005-02-11 22:50 ` bangerth at dealii dot org
2005-02-14 20:21 ` reichelt at gcc dot gnu dot org
2005-05-19 17:48 ` [Bug c++/19253] [3.4/4.0/4.1 " mmitchel at gcc dot gnu dot org
2005-07-22 21:18 ` pinskia at gcc dot gnu dot org
2005-09-06 15:27 ` reichelt at gcc dot gnu dot org
2005-09-27 16:24 ` 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).