The following invalid code snippet triggers an ICE on mainline:

====================================
template<typename> struct A
{
  typedef int X;
  A() { T().~X(); }
};

A<int> a;
====================================

bug.cc: In constructor 'A< <template-parameter-1-1> >::A()':
bug.cc:4: error: there are no arguments to 'T' that depend on a template
parameter, so a declaration of 'T' must be available
bug.cc:4: error: (if you use '-fpermissive', G++ will accept your code, but
allowing the use of an undeclared name is deprecated)
bug.cc: In constructor 'A< <template-parameter-1-1> >::A() [with
<template-parameter-1-1> = int]':
bug.cc:7:   instantiated from here
bug.cc:4: error: 'T' was not declared in this scope
bug.cc:4: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in finish_pseudo_destructor_expr, at
cp/semantics.c:2035
Please submit a full bug report, [etc.]

The ICE appeared between 2007-10-26 and 2007-11-03, so it probably fallout from

2007-11-01  Jakub Jelinek  <[EMAIL PROTECTED]>

        PR c++/32384
        * parser.c (cp_parser_postfix_dot_deref_expression): If
        POSTFIX_EXPRESSION is type dependent, try to parse it as pseudo dtor
        first and if that succeeds and type is SCALAR_TYPE_P, create
        PSEUDO_DTOR_EXPR.


-- 
           Summary: [4.3 regression] ICE using pseudo-destructor for invalid
                    expression
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, error-recovery, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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

Reply via email to