Skip to content
Snippets Groups Projects
Commit 78a159d0 authored by Robert K's avatar Robert K Committed by Simon Praetorius
Browse files

[feature] Added check for detected_or_fallback_t.

parent 0ff46d24
No related branches found
No related tags found
1 merge request!1164[feature] added a class detected_or_warning_t which checks if a type
Pipeline #53148 passed
Pipeline: Dune Nightly Test

#53150

    ......@@ -327,6 +327,10 @@ dune_add_test(SOURCES stdapplytest.cc
    LINK_LIBRARIES dunecommon
    LABELS quick)
    dune_add_test(SOURCES stdchecktypes.cc
    LINK_LIBRARIES dunecommon
    LABELS quick)
    dune_add_test(SOURCES streamoperatorstest.cc
    LABELS quick)
    ......
    // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
    // vi: set et ts=4 sw=2 sts=2:
    #ifdef HAVE_CONFIG_H
    #include "config.h"
    #endif
    #include <tuple>
    #include <utility>
    #include <sstream>
    #include <dune/common/std/type_traits.hh>
    struct A
    {
    typedef long type;
    };
    struct B
    {
    };
    template <class Traits>
    struct C
    {
    template <class T>
    using Fallback = int;
    template <class T>
    using Target = typename T::type;
    using type = Dune::detected_or_fallback_t<Fallback, Target, Traits>;
    void foo() { };
    };
    int main()
    {
    C< A > ca;
    ca.foo();
    // this should produce a compiler warning
    C< B > cb;
    cb.foo();
    }
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment