In following example struct Derived<T>
inherits from Base<T>
and defines an alias to its parent with the name Base
:
template <class T>
struct Base {
Base(int) {}
};
template <class T>
struct Derived : Base<T> {
using Base = Base<T>;
Derived() : Base(1) {}
};
int main() {
Derived<char> x;
}
Clang permits this code, but GCC prints the error:
error: declaration of 'using Base = struct Base<T>' changes meaning of 'Base' [-fpermissive]
Demo: https://gcc.godbolt.org/z/srMT7hdWr
Which compiler is right here?