From 1a49e9dc877a5eec5312baa1d3ce1e34b13e61d9 Mon Sep 17 00:00:00 2001 From: John McCall Date: Wed, 2 Dec 2009 19:59:55 +0000 Subject: [PATCH] Recognize that EnumConstantDecls can be found by lookup and are not instance members. Fixes PR5667. llvm-svn: 90341 --- clang/lib/Sema/SemaExpr.cpp | 3 +++ clang/test/SemaCXX/qualified-id-lookup.cpp | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 01c77966244b..8e1e0afaa643 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -733,6 +733,9 @@ static bool IsProvablyNotDerivedFrom(Sema &SemaRef, } static bool IsInstanceMember(NamedDecl *D) { + if (isa(D)) + return false; + assert(isa(D->getDeclContext()) && "checking whether non-member is instance member"); diff --git a/clang/test/SemaCXX/qualified-id-lookup.cpp b/clang/test/SemaCXX/qualified-id-lookup.cpp index 254a18de1f32..5a11a0cd07b8 100644 --- a/clang/test/SemaCXX/qualified-id-lookup.cpp +++ b/clang/test/SemaCXX/qualified-id-lookup.cpp @@ -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 struct is_class { + enum { value = 0 }; + }; + + template class ClassChecker { + bool isClass() { + return is_class::value; + } + }; + + template class ClassChecker; +}