https://bugs.llvm.org/show_bug.cgi?id=38426

            Bug ID: 38426
           Summary: [OpenCL C++] Lambda/Functions broken in templates
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: OpenCL
          Assignee: unassignedclangb...@nondot.org
          Reporter: erich.ke...@intel.com
                CC: llvm-bugs@lists.llvm.org

as you can see here: 

https://godbolt.org/g/PnxFQJ

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to