Index: lib/Sema/SemaExpr.cpp
===================================================================
--- lib/Sema/SemaExpr.cpp	(revision 237312)
+++ lib/Sema/SemaExpr.cpp	(working copy)
@@ -8954,7 +8954,7 @@
 /// 'const' due to being captured within a block?
 enum NonConstCaptureKind { NCCK_None, NCCK_Block, NCCK_Lambda };
 static NonConstCaptureKind isReferenceToNonConstCapture(Sema &S, Expr *E) {
-  assert(E->isLValue() && E->getType().isConstQualified());
+  assert(E->isModifiableLvalue(S.getASTContext()) == Expr::MLV_ConstQualified);
   E = E->IgnoreParens();
 
   // Must be a reference to a declaration from an enclosing scope.
Index: test/Sema/invalid-assignment-constant-address-space.c
===================================================================
--- test/Sema/invalid-assignment-constant-address-space.c	(revision 0)
+++ test/Sema/invalid-assignment-constant-address-space.c	(working copy)
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+#define OPENCL_CONSTANT 16776962
+int __attribute__((address_space(OPENCL_CONSTANT))) c[3] = {0};
+
+void foo() {
+  c[0] = 1; //expected-error{{read-only variable is not assignable}}
+}
