Skip to content
  • Steffen Müthing's avatar
    [Bugfix][Backport] Fix SFINAE logic picking specialization for global functions · 281a81ad
    Steffen Müthing authored
    As discussed in FS#1179, the SFINAE logic responsible for picking the correct implementation
    for global functions tests for the presence of the member name Traits::dimDomain to make its
    decision.
    Unfortunately, this test relies on a narrowing conversion that has been removed from C++11,
    so the SFINAE incorrectly fails on clang (GCC still accepts the narrowing conversion). The
    initial suggestion of just using (Basis::Traits::dimDomain,true) for the condition fails on
    GCC < 4.6 and generates warnings on newer versions.
    
    So, it's time for the infamous mantra of the additional indirection: This patch wraps the
    value of dimDomain in an integral_constant and stuffs the resulting type into AlwaysTrue.
    That fix works on GCC4.[2..8] and recent versions of clang without generating a warning.
    
    Fixes FS#1179.
    281a81ad