This patch fixes two instances of not deducing address spaces for global template variables.
I've added OpenCL address space deduction to the functions responsible for specializing template variable declarations,
and while this does give the correct address spaces, it is not optimal, as this same address space is deduced at least three times for a single variable.
It would be better if the correct type was correctly passed forward through the phases, which I've explained in the comments.
Since the variable is templated I'm not entirely certain if this is feasible or worthwhile compared to the simple solution of rededucing the address space several times.
I've also included this an example of this in the test for address space deductions
Is this still an issue with your new patch? I presume deducing the address space early would still be better in general but it seems not to play well with the way the template instantiation is implemented currently. Although it might generally be safer not to deduce anything for templates until the final instantiation is done.