[Bug c++/70106] [4.9/5.3/6.0][C++11 or above] adding parenthesis [cerr << (var)] cause error: invalid static_cast from type 'const size_t {aka const long unsigned int}' to type 'size_t& {aka long unsigned int&}'

ppalka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Mar 6 22:59:00 GMT 2016


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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Hmm, I can't reproduce the error with -std=c++11, only -std=c++14.

Reduced test case:

struct A
{
  int x;

  void foo () const {
    (A::x);
  };
};

void
foo ()
{
  A ().foo ();
}


More information about the Gcc-bugs mailing list