using declaration引用C,它是D的baseclass(别名),但不被识别为有效

Using declaration refers into C, which is a base class (alias) of D, but it is not recognized as valid

这看起来像是 clang 中的一个问题(我已经打开了 bug to clang),但我想确定我没有做错。

考虑以下代码:

struct B { };

template<typename...>
struct D;

template<typename T, typename U, typename... A>
struct D<T, U, A...>: D<U, A...> {
    using C = D<U, A...>; // (1)
    // using D<U, A...>::D; // (2)
    // using C::C; // (3)
    using C::D; // (4)
};

template<typename T>
struct D<T>: T { using T::T; };

int main() {
    D<int, double, B> d{};
}

第 (2) 行(如果注释掉 (1) 和 (4))和 (3)(如果注释掉 (4))按预期工作,而 (1)(上面的示例原样)给出以下错误:

11 : error: dependent using declaration resolved to type without 'typename'
using C::D;

[...]

11 : error: using declaration refers into 'C::', which is not a base class of 'D'
using C::D;

无论如何,CD<U, A...> 的别名,它是 D<T, U, A...> 的基础 class。
据我所知,该片段应该可以编译。我错了吗?

请注意 GCC 至少从 v4.8.1 to v6.1.

开始编译它

如 clang 的票中所述,它不能被视为错误(可能):

Clang is following the direction of core issue 2070 (http://wg21.link/cwg2070), which matches the intent of the original proposal (see the end of "Outline of the Solution" in http://wg21.link/n2540). As such, this is working as intended. To inherit a constructor, you need to use the same identifier before and after the ::.