[Bug c++/105050] error: expression '<statement>' is not a constant expression

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 7 01:18:59 GMT 2022


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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think clang still gives a better error message here though:
<source>:43:15: error: static assertion expression is not an integral constant
expression
static_assert(test_swap());
              ^~~~~~~~~~~
<source>:18:17: note: non-constexpr function '_M_swap_val' cannot be used in a
constant expression
          this->_M_swap_val(__x);
                ^
<source>:38:6: note: in call to '&e1->swap(e2)'
  e1.swap(e2);
     ^
<source>:43:15: note: in call to 'test_swap()'
static_assert(test_swap());
              ^
<source>:4:10: note: declared here
    void _M_swap_val(expected&) { }
         ^


More information about the Gcc-bugs mailing list