[Bug sanitizer/71962] error: ‘((& x) != 0u)’ is not a constant expression

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jul 21 12:29:00 GMT 2017


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-07-21
     Ever confirmed|0                           |1
      Known to fail|7.0                         |7.1.0, 8.0

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
A simpler test:

int main()
{
  static constexpr int x = 0;
  static_assert(bool(&x), "");
}

ubsan.cc: In function ‘int main()’:
ubsan.cc:4:3: error: non-constant condition for static assertion
   static_assert(bool(&x), "");
   ^~~~~~~~~~~~~
ubsan.cc:4:17: error: ‘((& x) != 0)’ is not a constant expression
   static_assert(bool(&x), "");
                 ^~~~~~~~


More information about the Gcc-bugs mailing list