From 0382a41d63c0a99ac2f92d831f31af8b6203b2f3 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 16 Apr 2019 21:06:41 +0200 Subject: [PATCH] re PR c++/86953 (compiler crashes with constexpr operator== and specific struct (cxx_eval_bit_field_ref, at cp/constexpr.c:2704)) PR c++/86953 * g++.dg/cpp0x/constexpr-86953.C: New test. From-SVN: r270396 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/constexpr-86953.C | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-86953.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 96d6b1e867b..6abbc572ded 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-04-16 Jakub Jelinek + + PR c++/86953 + * g++.dg/cpp0x/constexpr-86953.C: New test. + 2019-04-16 Dominique d'Humieres * g++.dg/lto/pr89358_0.C: Replace dg-* with dg-lto-*. diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-86953.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-86953.C new file mode 100644 index 00000000000..2eabe48d1da --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-86953.C @@ -0,0 +1,19 @@ +// PR c++/86953 +// { dg-do run { target c++11 } } +// { dg-options "-O2" } + +struct B { + double x; + bool y, z; + constexpr bool operator== (const B& o) const noexcept + { + return x == o.x && y == o.y && z == o.z; + } + constexpr bool operator!= (const B& o) const noexcept { return !(*this == o); } +}; + +int +main () +{ + bool b = B{} == B{}; +} -- 2.30.2