The following valid code snippet triggers an ICE since GCC 3.4.0:

==========================
struct A
{
  int i;
};

template<int> void foo()
{
  int x[A().i];
}
==========================

bug.cc: In function 'void foo()':
bug.cc:8: internal compiler error: in value_dependent_expression_p, at
cp/pt.c:12761
Please submit a full bug report, [etc.]

The following similar code snippet triggers an ICE since GCC 4.0.0:

==========================
struct A
{
  static int i;
};

template<int> void foo()
{
  int x[A::i];
}
==========================

bug.cc: In function 'void foo()':
bug.cc:8: internal compiler error: tree check: did not expect class 'type',
have 'type' (record_type) in contains_placeholder_p, at tree.c:2190
Please submit a full bug report, [etc.]


-- 
           Summary: [4.0/4.1/4.2 regression] ICE with variable-sized array
                    in template function
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, 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=28879

Reply via email to