Anastasia marked an inline comment as done.
Anastasia added inline comments.


================
Comment at: lib/Sema/SemaType.cpp:7232
+      if (D.getContext() == DeclaratorContext::TemplateArgContext)
+        // Do not deduce address space for non-pointee type in template arg.
+        ;
----------------
rjmccall wrote:
> I don't understand what you're trying to do here.  Template arguments may 
> need to be directly qualified with an address-space sometimes, and if you 
> prevent that unconditionally you're going to break all sorts of things, like 
> partially-specializing a template based on the presence of an address-space 
> qualifier.
I want to prevent deduction of address spaces for template arguments (when they 
are not specified explicitly).

Without this change, this example won't compile:
  template <typename T>
  void foo() {
    static __global T i;
  }
  foo<int>(); // error because int here is deduced to __private int (so i will 
have conflicting addr space quals)
But I think it's perfectly reasonable to compile this example because the addr 
space qual of `i` is specified to be `__global`.

Basically I am just trying to fix OpenCL C deduction rules that didn't account 
for the logic of templates.



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55127/new/

https://reviews.llvm.org/D55127



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to