c++/833: ICE related to missing typename keyword with -pedantic-errors

ljrittle@acm.org ljrittle@acm.org
Fri Nov 17 06:36:00 GMT 2000


>Number:         833
>Category:       c++
>Synopsis:       ICE related to missing typename keyword with -pedantic-errors
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          ice-on-illegal-code
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 17 06:36:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     ljrittle@acm.org
>Release:        unknown-1.0
>Organization:
>Environment:

>Description:
This test case was abstracted from libstdc++-v3.  It currently
produces the following:

; /usr/local/beta-gcc/bin/g++ -c -pedantic-errors tt2.C 
tt2.C: In member function `int bar<_CharT>::foo()':
tt2.C:19: parse error before ';' token
tt2.C:22: Internal error #122.
tt2.C:22: Internal compiler error in finish_function, at cp/decl.c:14246
confused by earlier errors, bailing out

No current g++ test case covers this failure as the only code in
libstdc++-v3 that caused the problem was conditionally used and has
now been changed to add the typename keyword.

Regards,
Loren

// Test for handling of missing typename keyword - ljr
// Build don't link: 
// Special Options: -pedantic-errors
template<class _CharT>
struct char_traits
{
  typedef unsigned long int_type;
};

template<typename _CharT>
class bar
{
  typedef char_traits<_CharT> __traits_type;

public:
  int foo ()
  {
    int __p = 1;
    if (static_cast<__traits_type::int_type>(__p))
      return 1;
    return 0;
  }
};
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-bugs mailing list