This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/72481] New: Compile error for varadic template


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72481

            Bug ID: 72481
           Summary: Compile error for varadic template
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liweifriends at gmail dot com
  Target Milestone: ---

The code is as follows:
===================================================================
// Code Pos 1
//template <typename...T> struct PolicyContainer;

template <typename...T> struct DummyLayer2;

template <typename TNewPolicy, typename TOriLayer> struct ChangePolicyHelper;

template <typename TNewPolicy, template<typename...> class TLayer, typename...
TPolicies>
struct ChangePolicyHelper<TNewPolicy, TLayer<TPolicies...>>
{
    // Code Pos 2
    template <typename...T> struct PolicyContainer;

    template <typename TPC, typename... TP>
    struct DropAppendHelper;

    template <typename... TFilteredPolicies>
    struct DropAppendHelper<PolicyContainer<TFilteredPolicies...>>
    {
        using type = DummyLayer2<TFilteredPolicies..., TNewPolicy>;
    };

    template <typename... TFilteredPolicies, typename TCurPolicy, typename...
TP>
    struct DropAppendHelper<PolicyContainer<TFilteredPolicies...>,
                            TCurPolicy, TP...>
    {
        using t1 = PolicyContainer<TFilteredPolicies...>;
        using type = typename DropAppendHelper<t1, TP...>::type;
    };

    template <typename...TFilteredPolicies, typename...TCurPolicy,
              template<typename...> class TC, typename...TP>
    struct DropAppendHelper<PolicyContainer<TFilteredPolicies...>,
                            TC<TCurPolicy...>, TP...>
    {
        using t1 = TC<TCurPolicy...>;
        using t2 = PolicyContainer<TFilteredPolicies..., t1>;
        using type = typename DropAppendHelper<t2, TP...>::type;
    };

    using type = typename DropAppendHelper<PolicyContainer<>,
TPolicies...>::type;
};

template <typename TLayer>
using SetFeedbackOut = typename ChangePolicyHelper<int, TLayer>::type;

using OriLayer2 = DummyLayer2<DummyLayer2<struct Tag1>>;
using NewLayer2 = SetFeedbackOut<OriLayer2>;
===================================================================

When Compile, the compiler reports an compile error.
However, with the following modification, the code could be compiled:

===================================================================
// Code Pos 1
template <typename...T> struct PolicyContainer;
...
    // Code Pos 2
    // template <typename...T> struct PolicyContainer;
===================================================================

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]