Menu

#5600 Fix hidden member templates in derived classes

Fixed
Enhancement
2019-11-19
2019-11-14
No

Fix hidden member templates in derived classes

According to Clang's interpretation of the C++ standard, "member
functions in the derived class override and/or hide member functions
with the same name and parameter types in a base class". This seems
to also hold for templated member functions and even if the code has
a using-declaration of the base class member.
This affects LilyPond's implementation of the method_finder template.
Luckily, the problem can be solved by just re-declaring the base
template specializations in each derived class instead of 'using' them.
The only drawback is that this doesn't work out-of-the-box for deeper
inheritance hierarchies. However, this only affects three ligature
engravers so I think it's worth the maintenance to just encode the
transitive inheritance manually.

http://codereview.appspot.com/559250043

Discussion

  • Anonymous

    Anonymous - 2019-11-14
    • Description has changed:

    Diff:

    
    
    • Needs: -->
    • Patch: new --> review
     
  • Anonymous

    Anonymous - 2019-11-14

    Passes make. make check and a full make doc.

     
  • Anonymous

    Anonymous - 2019-11-16
    • Patch: review --> countdown
     
  • Anonymous

    Anonymous - 2019-11-16

    Patch on countdown for Nov 18th

     
  • Jonas Hahnfeld

    Jonas Hahnfeld - 2019-11-18

    Move comment that I overlooked

    http://codereview.appspot.com/559250043

     
  • Jonas Hahnfeld

    Jonas Hahnfeld - 2019-11-18
    • Needs: -->
    • Patch: new --> countdown
    • Type: -->
     
  • Anonymous

    Anonymous - 2019-11-18
    • Patch: countdown --> push
    • Type: --> Enhancement
     
  • Anonymous

    Anonymous - 2019-11-18

    Patch counted down - please push.

     
  • Jonas Hahnfeld

    Jonas Hahnfeld - 2019-11-19
    • labels: --> Fixed_2_21_0
    • status: Started --> Fixed
    • Patch: push -->
     
  • Jonas Hahnfeld

    Jonas Hahnfeld - 2019-11-19

    Pushed as

    commit 26b9b8e42a93b3b9a34effcfb61840d22ef9b272
    Author: Jonas Hahnfeld <hahnjo@hahnjo.de>
    Date:   Thu Nov 14 09:22:03 2019 +0100
    
        Issue 5600: Fix hidden member templates in derived classes
    
        According to Clang's interpretation of the C++ standard, "member
        functions in the derived class override and/or hide member functions
        with the same name and parameter types in a base class". This seems
        to also hold for templated member functions and even if the code has
        a using-declaration of the base class member.
        This affects LilyPond's implementation of the method_finder template.
        Luckily, the problem can be solved by just re-declaring the base
        template specializations in each derived class instead of 'using' them.
        The only drawback is that this doesn't work out-of-the-box for deeper
        inheritance hierarchies. However, this only affects three ligature
        engravers so I think it's worth the maintenance to just encode the
        transitive inheritance manually.