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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.03.07 10:30:34
   Target Milestone|---                         |4.6.0
            Summary|Regression in Template      |[4.6 Regression] Regression
                   |Constants from 4.5.2        |in Template Constants from
                   |                            |4.5.2
     Ever Confirmed|0                           |1

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-07 
10:30:34 UTC ---
At least the error is confusing:

/usr/local/include/boost/mpl/aux_/integral_wrapper.hpp:73:96: error:
‘2147483647’ is not a valid template argument for type ‘int’ because
it is a non-constant expression

as ‘2147483647’ clearly looks like a constant expression ;)  It probably
should say '-2147483648 - 1' is not a constant expression - not sure
how difficult that would be.

-fpermissive doesn't make us accept the code.

Testcase w/o include:

template<int N>
struct test
{
          typedef test<N - 1> prior;
};

typedef test<-2147483647-1> foo;

foo f;

int main()
{
}


4.5 issues

t.C: In instantiation of 'test<-0x00000000080000000>':
t.C:9:5:   instantiated from here
t.C:4:31: warning: integer overflow in expression

that makes more sense.  We probably can go back to this behavior with
-fpermissive if accepting TREE_OVERFLOW consts as constant expressions.

Reply via email to