Index: lib/Sema/SemaChecking.cpp =================================================================== --- lib/Sema/SemaChecking.cpp +++ lib/Sema/SemaChecking.cpp @@ -8955,6 +8955,11 @@ LHS = LHS->IgnoreParenImpCasts(); RHS = RHS->IgnoreParenImpCasts(); + if (!S.getLangOpts().CPlusPlus) { + if (const TypeOfExprType *TET = dyn_cast(RHS->getType())) + RHS = TET->getUnderlyingExpr()->IgnoreParenImpCasts(); + } + // Check to see if one of the (unmodified) operands is of different // signedness. Expr *signedOperand, *unsignedOperand; Index: test/Sema/compare.c =================================================================== --- test/Sema/compare.c +++ test/Sema/compare.c @@ -391,3 +391,15 @@ void test12(unsigned a) { if (0 && -1 > a) { } } + +// PR36008 + +enum PR36008EnumTest { + kPR36008Value = 0, +}; + +void pr36008(enum PR36008EnumTest lhs) { + __typeof__(lhs) x = lhs; + __typeof__(kPR36008Value) y = (kPR36008Value); + if (x == y) x = y; // no warning +}