The following invalid code snippet triggers an ICE since GCC 4.4.0: ====================================== template<int> struct A { int i; friend void foo() { int x[i]; } };
struct B { int j; friend int bar() { return j; } }; ====================================== bug.cc: In function 'void foo()': bug.cc:3:7: error: invalid use of non-static data member 'A<<anonymous> >::i' bug.cc:4:29: error: from this location bug.cc: In function 'int bar()': bug.cc:9:7: error: invalid use of non-static data member 'B::j' bug.cc:10:29: error: from this location bug.cc:10:29: internal compiler error: tree check: expected class 'expression', have 'exceptional' (error_mark) in fold_build_cleanup_point_expr, at fold-const.c:15537 Please submit a full bug report, [etc.] -- Summary: [4.4/4.5 Regression] ICE with invalid use of non-static data members Product: gcc Version: 4.5.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=40372