Use RecordFirst/RecordLast range checks in DeclContext

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65489 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Douglas Gregor 2009-02-26 00:02:51 +00:00
Родитель 7f43d67647
Коммит 65100792a6
3 изменённых файлов: 14 добавлений и 5 удалений

Просмотреть файл

@ -440,7 +440,7 @@ public:
} }
bool isRecord() const { bool isRecord() const {
return DeclKind == Decl::Record || DeclKind == Decl::CXXRecord; return DeclKind >= Decl::RecordFirst && DeclKind <= Decl::RecordLast;
} }
bool isNamespace() const { bool isNamespace() const {

Просмотреть файл

@ -409,7 +409,7 @@ bool DeclContext::isTransparentContext() const {
return true; // FIXME: Check for C++0x scoped enums return true; // FIXME: Check for C++0x scoped enums
else if (DeclKind == Decl::LinkageSpec) else if (DeclKind == Decl::LinkageSpec)
return true; return true;
else if (DeclKind == Decl::Record || DeclKind == Decl::CXXRecord) else if (DeclKind >= Decl::RecordFirst && DeclKind <= Decl::RecordLast)
return cast<RecordDecl>(this)->isAnonymousStructOrUnion(); return cast<RecordDecl>(this)->isAnonymousStructOrUnion();
else if (DeclKind == Decl::Namespace) else if (DeclKind == Decl::Namespace)
return false; // FIXME: Check for C++0x inline namespaces return false; // FIXME: Check for C++0x inline namespaces

Просмотреть файл

@ -37,11 +37,19 @@ template <> struct X<float> { int bar(); }; // #2
typedef int int_type; typedef int int_type;
void testme(X<int_type> *x1, X<float, int> *x2) { void testme(X<int_type> *x1, X<float, int> *x2) {
x1->foo(); // okay: refers to #1 (void)x1->foo(); // okay: refers to #1
x2->bar(); // okay: refers to #2 (void)x2->bar(); // okay: refers to #2
} }
// Diagnose specializations in a different namespace // Make sure specializations are proper classes.
template<>
struct A<char> {
A();
};
A<char>::A() { }
// Diagnose specialization errors
struct A<double> { }; // expected-error{{template specialization requires 'template<>'}} struct A<double> { }; // expected-error{{template specialization requires 'template<>'}}
template<typename T> // expected-error{{class template partial specialization is not yet supported}} template<typename T> // expected-error{{class template partial specialization is not yet supported}}
@ -72,3 +80,4 @@ namespace M {
template<> struct N::B<char> { template<> struct N::B<char> {
int testf(int x) { return f(x); } int testf(int x) { return f(x); }
}; };