This is a straw-man idea for solving binding references with address spaces to temporaries. If the logic below makes sense I will apply it elsewhere in similar checks.
Arbitrary address space references can't be bound to temporaries. The reference binding logic should check that the address space of temporary can be implicitly converted to address space in reference when temporary materialization is performed.
Example:
_AS1 float gf; ... _AS1 const int& ref = gf; //this can only be accepted if implicit conversion from _AS1 to LangAS::Default is allowed
This review depends on: https://reviews.llvm.org/D58060