[llvm-bugs] [Bug 38426] New: [OpenCL C++] Lambda/Functions broken in templates

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 2 08:27:53 PDT 2018


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: unassignedclangbugs at nondot.org
          Reporter: erich.keane at intel.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180802/6e471521/attachment.html>


More information about the llvm-bugs mailing list