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

Andreas Herrmann <andreash87 at gmx dot ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andreash87 at gmx dot ch

--- Comment #2 from Andreas Herrmann <andreash87 at gmx dot ch> ---
I just stumbled up this problem in GCC 5.2.0. And it seems that Bug 66336 is a
duplicate of this one.

$ g++ --version
g++ (GCC) 5.2.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat bug.cc
template <class T, T value_>
struct constant {
    using type = T;
    static constexpr T value = value_;
};

template <class Constant>
constexpr typename Constant::type get = Constant::value;

template <class... Args>
void callme(Args...) {}

template <class... Args>
void works(Args...) {
    callme(Args::value...);
}

template <class... Args>
void fails(Args...) {
    callme(get<Args>...);  // !!! Parameter pack is not expanded.
}

int main() {
    int x = get<constant<int, 1>>;  // The variable template works on its own.
    works(constant<int, 0>{}, constant<int, 1>{});
    fails(constant<int, 0>{}, constant<int, 1>{});
}

$ g++ -std=c++14 bug.cc
bug.cc: In function ‘void fails(Args ...)’:
bug.cc:20:21: error: expansion pattern ‘get<Args>’ contains no argument packs
     callme(get<Args>...);  // !!! Parameter pack is not expanded.

Reply via email to