misc9.c

来自「linux下编程用 编译软件」· C语言 代码 · 共 29 行

C
29
字号
// { dg-do assemble  }// GROUPS passed miscellaneous//The program listed below produces the following error during compilation://   % g++ bug17.cc//   bug17.cc: In method `class Y& Y::operator = (const class Y&)'://   bug17.cc:18: invalid use of non-lvalue arrayclass X {public:   X& operator=(const X&) { return *this; }};struct S {   char c[10];   X x;};class Y {   S s;public:   const S& f() const { return s; }   Y& operator=(const Y& _Y) {      s = _Y.s;    // this line compiles      s = _Y.f();  // this line does not compile      return *this;   }};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?