Skip to content

Generic C++ 14 Lamda function does not work  #9

@SimeonEhrig

Description

@SimeonEhrig

Problem

$ cling -std=c++14 -xcuda

****************** CLING ******************
* Type C++ code and press enter to run it *
*             Type .q to exit             *
*******************************************
[cling]$ auto lambda = [](auto x, auto y) {return x + y;}
((lambda) &) @0x7f7df8b52018
[cling]$ lambda(3.7, 2.8)
input_line_5:2:2: error: type '(lambda at input_line_3:2:16)' does not provide a call operator
 lambda(3.7, 2.8)
 ^~~~~~
IncrementalCUDADeviceCompiler::process()
failed at compile ptx code
(double) 6.5000000
[cling]$ .q

Hint

Set C++14 on the device compiler works.

$ cling -std=c++11 -xcuda

****************** CLING ******************
* Type C++ code and press enter to run it *
*             Type .q to exit             *
*******************************************
[cling]$ auto lambda = [](auto x, auto y) {return x + y;}
input_line_3:2:19: error: 'auto' not allowed in lambda parameter
 auto lambda = [](auto x, auto y) {return x + y;}
                  ^~~~
input_line_3:2:27: error: 'auto' not allowed in lambda parameter
 auto lambda = [](auto x, auto y) {return x + y;}
                          ^~~~
IncrementalCUDADeviceCompiler::process()
failed at compile ptx code
input_line_3:2:19: error: 'auto' not allowed in lambda parameter
 auto lambda = [](auto x, auto y) {return x + y;}
                  ^~~~
input_line_3:2:27: error: 'auto' not allowed in lambda parameter
 auto lambda = [](auto x, auto y) {return x + y;}
                          ^~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions