clang 3.1(trunk) に Forward declarations for enums が実装された
clang 3.1(trunk) に Forward declarations for enums が実装されました。
[ソース]
template<typename T> struct X{ enum E : T; E n; }; template<typename T> enum X<T>::E : T{ e1, e2 }; #include <iostream> int main(){ X<int> x; x.n = X<int>::E::e1; X<int>::E e = X<int>::e2; // X<int>::E e2 = 10; // error std::cout << x.n << std::endl; std::cout << e << std::endl; return 0; }
[出力]
0 1
これでまだ実装されていない言語機能は『Generalized attributes』と『Inheriting constructors』の2つですね。
『Inheriting constructors』早く欲しい…!