[Bug c++/6273] [4.0/4.1 regression] User-defined operator+ and use of enum values in computation of array bounds

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Jun 23 03:47:00 GMT 2005


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-23 03:47 -------
(In reply to comment #7)
> ---------------------------------------------------------------------
> template <typename> struct X {
>     enum { N = 10 };
>     int items[N+1];
> };
> template <typename A, typename B> int operator+(A,B);
> X<int> x;
> ----------------------------------------------------------------------

Actually I think there is two different bugs here, the above code is vaild I think because operators just 
like functions have an overloaded set for lookup which is PR 2922.
The testcase which is questionable is:
template <typename A, typename B> int operator+(A,B);
template <typename> struct X {
    enum a{ N = 10 };
    int items[N+1];
};
X<int> x;

-- 


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



More information about the Gcc-bugs mailing list