递归typedef

fre*_*low 1 c++ recursion typedef

以下是允许的吗?

typedef Foo<Bar> Bar;
Run Code Online (Sandbox Code Playgroud)

我的编译器抱怨'class Bar'先前声明为'class Bar'.

小智 5

你在做什么相当于:

struct A {};
struct B {};
typedef A B;
Run Code Online (Sandbox Code Playgroud)

这并不令人惊讶不合法.