------- Additional Comments From reichelt at gcc dot gnu dot org 2005-01-07 13:14 ------- A testcase never made it to testsuite. :-(
Well, the ICE was fixed in gcc 3.2.1, I don't think we need a testcase for that one. The other issue is the testcase from comment #4: --------------------------------------------------------------------- template <typename> struct X { enum { N = 10 }; int items[N+1]; }; template <typename A, typename B> int operator+(A,B); X<int> x; ---------------------------------------------------------------------- The question is whether this is valid code or not. There are two issues involved: a) operator+ is defined *after* the definition of X. Do we really have to take it into account for overload resolution to compute N+1? Mark's opinion (as stated in private email) to this is "no". This would render the code valid. Alas, gcc *does* take operator+ into account. And that's a bug. b) Because gcc behaves wrong in a) we end up with a second problem: Anonymous types cannot be template parameters. That's not an SFINAE problem, this should be diagnosed as a hard error. However, gcc 3.4.0 - 3.4.3 treat this as an SFINAE case, thus accepting the code (although for the wrong reason). Mark's patch for PR17413 changed that behavior for mainline (maybe it will be backported to the 3.4 branch). So the code is again rejected - because of the bug in a). To make things short: We have a rejects-valid bug in mainline. To the user this is a regression from gcc 3.4.3, although the bug was latent in the compiler and papered over by a second bug (PR 17413). -- What |Removed |Added ---------------------------------------------------------------------------- CC| |mark at codesourcery dot com Status|RESOLVED |REOPENED Keywords| |monitored, rejects-valid Known to fail| |2.95.3 3.3.5 4.0.0 Known to work| |3.4.0 3.4.3 Resolution|FIXED | Summary|User-defined operator+ and |[4.0 regression] User- |use of enum values in |defined operator+ and use of |computation of array bounds |enum values in computation | |of array bounds Target Milestone|--- |4.0.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6273