<分区>
下面的代码
template<int c>
struct Base
{
static const int a = c + 5;
};
template<int c>
struct Derived : Base<c>
{
static const int b = a + 5;
};
...编译失败因为a was not declared in this scope
.明确指定 Base<c>::a
有效,但从逻辑上讲这不是必需的,因为我们是从 Base<c>
派生的.这是预期的行为(以及为什么)还是我遗漏了什么?