Commit 281a81ad authored by Steffen Müthing's avatar Steffen Müthing
Browse files

[Bugfix][Backport] Fix SFINAE logic picking specialization for global functions

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
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.
parent c002aa5c
......@@ -173,9 +173,16 @@ namespace Dune {
#ifndef DOXYGEN
//! Switch for uniform treatment of local and global basis classes
template<class Basis>
struct BasisInterfaceSwitch<
Basis, typename enable_if<Basis::Traits::dimDomain>::type
struct BasisInterfaceSwitch<Basis,
typename enable_if<
//! export field types of the coordinates
typedef typename Basis::Traits::DomainFieldType DomainField;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment