[Bug c++/19253] New: [3.4/4.0 regression] bad error message / ICE for invalid template parameter

reichelt at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Jan 4 14:31:00 GMT 2005


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



More information about the Gcc-bugs mailing list