【发布时间】:2015-12-03 20:01:35
【问题描述】:
这是我正在尝试做的最简单的情况:
template <template <typename...> class Wrapper>
struct WrapperTraits { };
template <typename... Whatever>
struct Foo {
private:
// I want Foo here to refer to the template, and not the current
// concrete type (which is injected into the namespace by default)
using Traits = WrapperTraits<Foo>;
};
int main()
{
return 0;
}
这是 clang 3.6 上的错误(它在 gcc 4.8 和 5.2 上编译良好):
error: template argument for template template parameter must be a class template or type alias template
using Traits = WrapperTraits<Foo>;
^
1 error generated.
Compilation failed
以下是 Godbolt 上的示例:https://goo.gl/cSx6QR
感谢您的帮助!
【问题讨论】:
-
template<class...Ts>using Foo_Z=Foo<Ts...>;然后使用Foo_Z? -
无法重现错误:ideone.com/rXiUhl
-
@tobi303 这是在 gcc 5.1 上。它无法在 clang 上编译。我在godbolt上提供了一个链接
-
对不起,我错过了“工作正常...”这一点
-
已知的 clang 错误。另一种解决方法是写
Foo::template Foo。