Index: lib/Sema/SemaExpr.cpp =================================================================== --- lib/Sema/SemaExpr.cpp +++ lib/Sema/SemaExpr.cpp @@ -12997,6 +12997,8 @@ Input = DefaultFunctionArrayLvalueConversion(Input.get()); if (Input.isInvalid()) return ExprError(); resultType = CheckIndirectionOperand(*this, Input.get(), VK, OpLoc); + // The result type of a dereferenced object is in the default addr space. + resultType = Context.removeAddrSpaceQualType(resultType); break; } case UO_Plus: Index: test/SemaOpenCLCXX/address_space_overloading.cl =================================================================== --- test/SemaOpenCLCXX/address_space_overloading.cl +++ test/SemaOpenCLCXX/address_space_overloading.cl @@ -1,12 +1,12 @@ // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=c++ -// FIXME: This test shouldn't trigger any errors. +// expected-no-diagnostics struct RetGlob { int dummy; }; -struct RetGen { //expected-error{{binding value of type '__generic RetGen' to reference to type 'RetGen' drops <> qualifiers}} +struct RetGen { char dummy; }; @@ -19,5 +19,5 @@ __local int *ArgLoc; RetGlob TestGlob = foo(ArgGlob); RetGen TestGen = foo(ArgGen); - TestGen = foo(ArgLoc); //expected-note{{in implicit copy assignment operator for 'RetGen' first required here}} + TestGen = foo(ArgLoc); }