Index: lib/Sema/SemaOverload.cpp =================================================================== --- lib/Sema/SemaOverload.cpp +++ lib/Sema/SemaOverload.cpp @@ -11804,7 +11804,8 @@ // various built-in candidates, but as DR507 points out, this can lead to // problems. So we do it this way, which pretty much follows what GCC does. // Note that we go the traditional code path for compound assignment forms. - if (Opc == BO_Assign && !Args[0]->getType()->isOverloadableType()) + if (!LangOpts.CPlusPlus || + (Opc == BO_Assign && !Args[0]->getType()->isOverloadableType())) return CreateBuiltinBinOp(OpLoc, Opc, Args[0], Args[1]); // If this is the .* operator, which is not overloadable, just Index: test/Sema/PR28181.c =================================================================== --- /dev/null +++ test/Sema/PR28181.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +struct spinlock_t { + int lock; +} audit_skb_queue; + +void fn1() { + audit_skb_queue = (lock); // expected-error {{use of undeclared identifier 'lock'; did you mean 'long'?}} +} // expected-error@-1 {{assigning to 'struct spinlock_t' from incompatible type ''}} + +void fn2() { + audit_skb_queue + (lock); // expected-error {{use of undeclared identifier 'lock'; did you mean 'long'?}} +} // expected-error@-1 {{reference to overloaded function could not be resolved; did you mean to call it?}}