<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [OpenCL C++] Lambda/Functions broken in templates"
   href="https://bugs.llvm.org/show_bug.cgi?id=38426">38426</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[OpenCL C++] Lambda/Functions broken in templates
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>OpenCL
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>erich.keane@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>as you can see here: 

<a href="https://godbolt.org/g/PnxFQJ">https://godbolt.org/g/PnxFQJ</a>

It appears that some of the OpenCL C++ implementation messes with the
qualifiers of function types, so this breaks.  I believe the lambda issue has
to do with address-space modification, but I'm not sure yet.

void func();

template<typename Func>
void foo(Func F) {
    F();
}

int main() {
    foo(func);
    foo([](){});
}

<source>:8:5: error: function cannot be called 'main'

int main() {

    ^

<source>:9:9: error: taking address of function is not allowed

    foo(func);

        ^

<source>:5:5: error: no matching function for call to object of type '(lambda
at <source>:10:9)'

    F();

    ^

<source>:10:5: note: in instantiation of function template specialization
'foo<(lambda at <source>:10:9)>' requested here

    foo([](){});

    ^

<source>:10:9: note: candidate function not viable: address space mismatch in
'this' argument ('(lambda at <source>:10:9)'), parameter type must be 'const
(lambda at <source>:10:9)'

    foo([](){});

        ^

<source>:10:9: note: conversion candidate of type 'void (*)()'

3 errors generated.

Compiler returned: 1</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>