0

此代码不使用 gcc HEAD 10.0.0 20190 编译,而是使用 clang HEAD 9.0.0 编译

#include <iostream>

struct A
{
    A() = default;
    A( int ) {}
};

struct B
{
    B() = default;
    B( const char * ) {}
};

template <typename...Bases>
struct C : Bases...
{
    using Bases::Bases...;
};

int main()
{
}

错误是

rog.cc:18:23: error: parameter packs not expanded with '...':
   18 |     using Bases::Bases...;
      |                       ^~~
prog.cc:18:23: note:         'Bases'
4

1 回答 1

4

Expansions are only allowed in using-declarations since C++17. (ref)

Looks like your GCC version just doesn't have that new feature yet, or does but in a buggy way (e.g. bug 79094).

于 2019-08-22T14:53:41.490 回答