C++;11在类的已完成范围内重新评估名称? 在C++ 3.3.7.2[Basic,Simule.Cype ] 中表示
类C++;11在类的已完成范围内重新评估名称? 在C++ 3.3.7.2[Basic,Simule.Cype ] 中表示,c++,c++11,language-lawyer,C++,C++11,Language Lawyer,类S中使用的名称N在上下文中以及在完成的S范围内重新评估时,应引用相同的声明 翻译单元的一个例子是什么,其中类S中使用的名称N在其上下文中引用的声明与在S的完整范围内重新评估时引用的声明不同?可能重复的 struct X {}; struct Y {}; typedef X N; struct S { N n; typedef Y N; }; $ g++ test.cpp 9:15: error: declaration of ‘typedef struct Y S::N
S
中使用的名称N
在上下文中以及在完成的S
范围内重新评估时,应引用相同的声明
翻译单元的一个例子是什么,其中类S
中使用的名称N
在其上下文中引用的声明与在S
的完整范围内重新评估时引用的声明不同?可能重复的
struct X {};
struct Y {};
typedef X N;
struct S
{
N n;
typedef Y N;
};
$ g++ test.cpp
9:15: error: declaration of ‘typedef struct Y S::N’ [-fpermissive]
4:11: error: changes meaning of ‘N’ from ‘typedef struct X N’ [-fpermissive]