Index: clang/lib/Sema/SemaOpenMP.cpp =================================================================== --- clang/lib/Sema/SemaOpenMP.cpp +++ clang/lib/Sema/SemaOpenMP.cpp @@ -4992,7 +4992,8 @@ bool VisitMemberExpr(const MemberExpr *E) { if (isa(E->getBase()->IgnoreParens())) { const ValueDecl *VD = E->getMemberDecl(); - return checkDecl(E, VD); + if (isa(VD) || isa(VD)) + return checkDecl(E, VD); } return false; } Index: clang/test/OpenMP/for_loop_messages.cpp =================================================================== --- clang/test/OpenMP/for_loop_messages.cpp +++ clang/test/OpenMP/for_loop_messages.cpp @@ -626,6 +626,8 @@ class TC { int ii, iii, kk; public: + enum { myconstant = 42 }; + int ub(); int dotest_lt(IT begin, IT end) { #pragma omp parallel // expected-error@+3 3 {{the loop initializer expression depends on the current loop control variable}} @@ -634,6 +636,12 @@ for (ii = ii * 10 + 25; ii < ii / ii - 23; ii += 1) ; +// Check that member function calls and enum constants in the condition is +// handled. +#pragma omp for + for (ii = 0; ii < ub() + this->myconstant; ii += 1) // expected-no-error + ; + #pragma omp parallel // expected-error@+4 2 {{expected loop invariant expression or ' * ii + ' kind of expression}} // expected-error@+3 {{expected loop invariant expression or ' * TC::ii + ' kind of expression}}