c++gccclangc++17inherited-constructors

Is there one more bug of the gcc compiler relative to inherited constructors?


This code does not compile using gcc HEAD 10.0.0 20190 but compiles using 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()
{
}

The error is

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

Solution

  • 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).