aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-10-02 09:47:00 -0700
committerNathan Sidwell <nathan@acm.org>2020-10-02 09:55:45 -0700
commit9340d1c97b8a7aa47aff677f9b6db4799670f47b (patch)
tree39e725b83b1effa518e1c43f6ef0e0757b957bff /libgcc
parent315848246657607d5acd9bca29d64d98a4c5f042 (diff)
downloadgcc-9340d1c97b8a7aa47aff677f9b6db4799670f47b.zip
gcc-9340d1c97b8a7aa47aff677f9b6db4799670f47b.tar.gz
gcc-9340d1c97b8a7aa47aff677f9b6db4799670f47b.tar.bz2
c++: cleanup ctor_omit_inherited_parms [PR97268]
ctor_omit_inherited_parms was being somewhat abused. What I'd missed is that it checks for a base-dtor name, before proceeding with the check. But we ended up passing it that during cloning before we'd completed the cloning. It was also using DECL_ORIGIN to get to the in-charge ctor, but we sometimes zap DECL_ABSTRACT_ORIGIN, and it ends up processing the incoming function -- which happens to work. so, this breaks out a predicate that expects to get the incharge ctor, and will tell you whether its base ctor will need to omit the parms. We call that directly during cloning. Then the original fn is essentially just a wrapper, but uses DECL_CLONED_FUNCTION to get to the in-charge ctor. That uncovered abuse in add_method, which was happily passing TEMPLATE_DECLs to it. Let's not do that. add_method itself contained a loop mostly containing an 'if (nomatch) continue' idiom, except for a final 'if (match) {...}' check, which itself contained instances of the former idiom. I refactored that to use the former idiom throughout. In doing that I found a place where we'd issue an error, but then not actually reject the new member. gcc/cp/ * cp-tree.h (base_ctor_omit_inherited_parms): Declare. * class.c (add_method): Refactor main loop, only pass fns to ctor_omit_inherited_parms. (build_cdtor_clones): Rename bool parms. (clone_cdtor): Call base_ctor_omit_inherited_parms. * method.c (base_ctor_omit_inherited_parms): New, broken out of ... (ctor_omit_inherited_parms): ... here, call it with DECL_CLONED_FUNCTION. gcc/testsuite/ * g++.dg/inherit/pr97268.C: New.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions