diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7e41433707e..32bb9f5dfa8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2020-05-06 Jakub Jelinek + + PR c++/94907 + * method.c (defaulted_late_check): Don't call synthesize_method + on constexpr sfk_comparison if it has been called on it already. + 2020-05-06 Nathan Sidwell PR c++/94946 diff --git a/gcc/cp/method.c b/gcc/cp/method.c index fb2dd47013f..47f96aa845e 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -2939,7 +2939,7 @@ defaulted_late_check (tree fn) { /* If the function was declared constexpr, check that the definition qualifies. Otherwise we can define the function lazily. */ - if (DECL_DECLARED_CONSTEXPR_P (fn)) + if (DECL_DECLARED_CONSTEXPR_P (fn) && !DECL_INITIAL (fn)) synthesize_method (fn); return; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6aa43787122..a2c0e8571d9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-05-06 Jakub Jelinek + + PR c++/94907 + * g++.dg/cpp2a/spaceship-synth8.C: New test. + 2020-05-06 qing zhao PR c/94230 diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-synth8.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-synth8.C new file mode 100644 index 00000000000..d0d68c7fa6f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-synth8.C @@ -0,0 +1,12 @@ +// PR c++/94907 +// { dg-do compile { target c++2a } } + +namespace std { struct strong_ordering { }; } + +struct E; +struct D { + virtual std::strong_ordering operator<=>(const struct E&) const = 0; +}; +struct E : D { + std::strong_ordering operator<=>(const E&) const override = default; +};