[PATCH] D95442: [OpenCL] Add diagnostics for references to functions

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 27 08:36:59 PST 2021


Anastasia added inline comments.


================
Comment at: clang/test/SemaOpenCLCXX/members.cl:17
-
-template <class T> struct remove_reference { typedef T type; };
-template <class T> struct remove_reference<T &> { typedef T type; };
----------------
mantognini wrote:
> I wonder, do we lose coverage by removing these templates?
> 
> In other words, is the same code for error detection used for templates and non-template?
I just think that this pattern has become untestable which means it is also not customer visible i.e. I used these to create a function pointer type in a template via template argument that was a reference to function. But now that we don't have neither pointers nor references to functions I don't think it is possible to write a template that would have any of those two after the substitution? I think the error will occur before - either when we specify the template argument or create a variable of those invalid types to be deduced in the templates.


================
Comment at: clang/test/SemaOpenCLCXX/references.cl:25
+#endif // FPTREXT
+typedef void (&ref2fct_t)();
+#ifndef FPTREXT
----------------
mantognini wrote:
> This re-uses the same name as above. Could that be an issue?
Not in this case because the type alias has not been created i.e. the parser just restarts over as if the first line with this type alias has not existed.


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

https://reviews.llvm.org/D95442



More information about the cfe-commits mailing list