This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/80129] wrong code with ternary struct assignment to const


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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-03-21
                 CC|                            |trippels at gcc dot gnu.org
     Ever confirmed|0                           |1
      Known to fail|                            |5.4.0, 6.3.0, 7.0

--- Comment #1 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
struct pair {
  bool first;
  int second;
};

int main() {
  bool b = false;
  const pair x = b ? pair{true, 1} : pair{false, 0};
  if (x.first)
    __builtin_abort();
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]