2016-06-01 9 views
4

これはclangの問題のようです(私はすでにbug to clangを開いています)。私が間違いをしていないことを確認してください。宣言の使用はDの基本クラス(エイリアス)ですが、有効とは認識されません

は、以下のコードを検討:

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))及び(コメントアウト場合(4))、予想通り(3)が、動作( 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...>の基本クラスです。
私が知る限り、そのスニペットはコンパイルする必要があります。私が間違っている?

GCCは少なくともv4.8.1からv6.1までコンパイルすることに注意してください。

+0

http://wg21.link/CWG2070 –

+0

だから、それはにISN修正そのうち問題ですまだ標準の一部ではないでしょうか?それは議論されるようにそれを言及する。 – skypjack

答えて

0

打ち鳴らすためのチケットで述べたように、それは(多分)バグと考えることはできません。

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 ::.

関連する問題