References to functions are less permissive than pointers to functions and therefore some use cases could be allowed for example:
- For local variables
- For non-extern static and global variables
- For template parameters that are not used as function parameters or class members
- In constexpr
However, more language work is needed to analyze the invalid/valid cases. This can be done in the future language versions if there is enough interest in the feature from the application developers. Even if we had a request for allowing some function pointer functionality (PR44788), OpenCL has never adopted the feature as a part of the standard and therefore many applications have been written successfully without it. On the other hand C++ provides other related features - lambdas and function objects that are allowed in OpenCL and can be used to express some sort of the indirect function call logic. For now it seems reasonable to just disallow the references to functions just like we disallow function pointers. This prevents erroneous programs from being compiled silently.
Note that for the advanced users there is the following extension available __cl_clang_function_pointers that can be used if there is knowledge about the application sources or compilation options to make sure the non-conformant functionality is safe (more details are in https://clang.llvm.org/docs/LanguageExtensions.html#opencl-features).