https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60049

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |msebor at gcc dot gnu.org
      Known to work|                            |5.3.0, 6.1.0
             Blocks|                            |55004
         Resolution|---                         |FIXED
      Known to fail|                            |4.9.3

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
GCC 4.9.3 still accepts the code, but GCC 5 and 6 reject it (see below).  Test
added in r236225.  Resolving as Fixed.

$ gcc -S -std=c++11 -w xx.cpp
xx.cpp: In function ‘int main()’:
xx.cpp:3:27: error: right operand of shift expression ‘(1 << 33)’ is >= than
the precision of the left operand [-fpermissive]
     constexpr int x1 =  1 << 33 ;
                         ~~^~~~~
xx.cpp:4:27: error: right operand of shift expression ‘(1 << -1)’ is negative
[-fpermissive]
     constexpr int x2 =  1 << -1 ;
                         ~~^~~~~
xx.cpp:5:28: error: left operand of shift expression ‘(-1 << 1)’ is negative
[-fpermissive]
     constexpr int x3 =  -1 << 1 ;
                         ~~~^~~~
xx.cpp:6:27: error: right operand of shift expression ‘(1 >> 33)’ is >= than
the precision of the left operand [-fpermissive]
     constexpr int x4 =  1 >> 33 ;
                         ~~^~~~~
xx.cpp:7:27: error: right operand of shift expression ‘(1 >> -1)’ is negative
[-fpermissive]
     constexpr int x5 =  1 >> -1 ;
                         ~~^~~~~


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55004
[Bug 55004] [meta-bug] constexpr issues

Reply via email to