# #
########################################################################
-#
-# In some cases, we would like to name partial specializations
-# as friends. However, the standard forbids us to do so. But
-# then, we can declare the general template as a friend, and
-# at least gcc extends the friendship to all specializations
-# of the templates, which is not what the standard says.
-#
-# With other compilers, most notably cxx, this does not work.
-# In this case, we can make individual specializations friends,
-# which in turn gcc rejects. So check, whether this is possible.
-#
-# The respective clause in the standard is 14.5.3.1, which gives
-# this example:
-# template<class T> class task {
-# friend class task<int>;
-# };
-#
-# - Wolfgang Bangerth, Matthias Maier, rewritten 2012
-#
-CHECK_CXX_COMPILER_BUG(
- "
- template <int N, typename T> class X;
- template <typename T> class X<1,T>;
-
- template <typename P> class Y {
- static int i;
- template <int N, typename T> friend class X;
- friend class X<1,P>;
- };
-
- template <typename T> class X<1,T> {
- int f () { return Y<T>::i; }; // access private field
- };
- int main() { return 0; }
- "
- DEAL_II_TEMPL_SPEC_FRIEND_BUG)
-
-
-#
-# This is a variant of the previous test. Some icc 11.0
-# builds (sub-releases) on Windows apparently don't allow
-# the declaration of an explicit specialization of member
-# arrays of templates:
-#
-# template <int dim>
-# struct X
-# {
-# static const int N = 2*dim;
-# static const int x[N];
-# };
-# template <> const int X<2>::x[N];
-#
-# That version of icc requests that there be an initialization,
-# i.e. it thinks that this is the *definition*, not merely a
-# *declaration* of an explicit specialization. This is wrong,
-# however.
-#
-# - Wolfgang Bangerth, Matthias Maier, rewritten 2012
-#
-CHECK_CXX_COMPILER_BUG(
- "
- template <int dim>
- struct X
- {
- static const int N = 2*dim;
- static const int x[N];
- };
- template <> const int X<2>::x[N];
- int main() { return 0; }
- "
- DEAL_II_MEMBER_ARRAY_SPECIALIZATION_BUG
- )
-
-
-#
-# Some older versions of gcc deduce pointers to const functions in
-# template contexts to pointer-to-function of const objects.
-# This is not correct
-#
-# Check for this misfeature.
-#
-# - Wolfgang Bangerth, Matthias Maier, rewritten 2012
-#
-CHECK_CXX_COMPILER_BUG(
- "
- template <typename T> struct identity { typedef T type; };
- template <typename C> void new_thread (void (C::*fun_ptr)(),
- typename identity<C>::type &c) {}
- template <typename C> void new_thread (void (C::*fun_ptr)() const,
- const typename identity<C>::type &c) {}
- struct X { void f() const{} };
-
- int main()
- {
- X x;
- new_thread (&X::f, x);
- }
- "
- DEAL_II_CONST_MEMBER_DEDUCTION_BUG
- )
-
-
-
-#
-# Microsoft Visual C++ has a bug where the resulting object
-# from calling std::bind does not have a const operator(),
-# so we cannot pass such objects as const references as we
-# usually do with input arguments of other functions.
-#
-# - Wolfgang Bangerth, 2014
-#
-ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${DEAL_II_CXX_FLAGS}")
-CHECK_CXX_COMPILER_BUG(
- "
- #include <functional>
-
- void f(int, int) {}
-
- template <typename F>
- void g(const F &func)
- {
- func(1);
- }
-
- int main ()
- {
- g (std::bind(&f, std::placeholders::_1, 1));
- }
- "
- DEAL_II_BIND_NO_CONST_OP_PARENTHESES
- )
-RESET_CMAKE_REQUIRED()
-
#
# In intel (at least 13.1 and 14), vectorization causes