aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/constexpr.cc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2022-04-14 15:34:14 -0400
committerJason Merrill <jason@redhat.com>2022-04-14 17:09:57 -0400
commitc5de3444c4798758cdd800eca144480b4a8ef299 (patch)
tree83f97afcf3f3fc3813319596582573e28e4acc10 /gcc/cp/constexpr.cc
parent82536fbb8a7d150b829650378e0ba07dad5c8fb8 (diff)
downloadgcc-c5de3444c4798758cdd800eca144480b4a8ef299.zip
gcc-c5de3444c4798758cdd800eca144480b4a8ef299.tar.gz
gcc-c5de3444c4798758cdd800eca144480b4a8ef299.tar.bz2
c++: constexpr trivial -fno-elide-ctors [PR104646]
The constexpr constructor checking code got confused by the expansion of a trivial copy constructor; we don't need to do that checking for defaulted ctors, anyway. PR c++/104646 gcc/cp/ChangeLog: * constexpr.cc (maybe_save_constexpr_fundef): Don't do extra checks for defaulted ctors. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/constexpr-fno-elide-ctors1.C: New test.
Diffstat (limited to 'gcc/cp/constexpr.cc')
-rw-r--r--gcc/cp/constexpr.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index b170053..e89440e 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -920,7 +920,8 @@ maybe_save_constexpr_fundef (tree fun)
if (!potential && complain)
require_potential_rvalue_constant_expression (massaged);
- if (DECL_CONSTRUCTOR_P (fun) && potential)
+ if (DECL_CONSTRUCTOR_P (fun) && potential
+ && !DECL_DEFAULTED_FN (fun))
{
if (cx_check_missing_mem_inits (DECL_CONTEXT (fun),
massaged, complain))