]> granicus.if.org Git - clang/commitdiff
Recognize that EnumConstantDecls can be found by lookup and are not instance
authorJohn McCall <rjmccall@apple.com>
Wed, 2 Dec 2009 19:59:55 +0000 (19:59 +0000)
committerJohn McCall <rjmccall@apple.com>
Wed, 2 Dec 2009 19:59:55 +0000 (19:59 +0000)
members.  Fixes PR5667.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90341 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/SemaCXX/qualified-id-lookup.cpp

index 01c77966244b4fad44403ed4993c8bdbf3365ae6..8e1e0afaa64393a0e443bac46bbaa6b71b8f5c00 100644 (file)
@@ -733,6 +733,9 @@ static bool IsProvablyNotDerivedFrom(Sema &SemaRef,
 }
                                   
 static bool IsInstanceMember(NamedDecl *D) {
+  if (isa<EnumConstantDecl>(D))
+    return false;
+
   assert(isa<CXXRecordDecl>(D->getDeclContext()) &&
          "checking whether non-member is instance member");
 
index 254a18de1f32aa5d4ee5713525a1238fa958234c..5a11a0cd07b83349dee32551687c42573aadf0cc 100644 (file)
@@ -109,3 +109,18 @@ struct Undef { // expected-note{{definition of 'struct Undef' is not complete un
 int Undef::f() {
   return sizeof(Undef);
 }
+
+// PR clang/5667
+namespace test1 {
+  template <typename T> struct is_class {
+    enum { value = 0 };
+  };
+
+  template <typename T> class ClassChecker {
+    bool isClass() {
+      return is_class<T>::value;
+    }
+  };
+
+  template class ClassChecker<int>;  
+}