[Bug c++/80795] New: Cannot take the address of call operator of a variadic lambda when parameter pack length differs from 1
gufideg at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed May 17 05:53:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80795
Bug ID: 80795
Summary: Cannot take the address of call operator of a variadic
lambda when parameter pack length differs from 1
Product: gcc
Version: 7.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gufideg at gmail dot com
Target Milestone: ---
Hi there, I stumble across this error:
int main() {
auto test = [](auto, auto, auto...) {};
auto ash = &decltype(test)::operator()<int, int>;
}
In this case, I expect the pointer to the function to be the one this
expression would call:
[](auto, auto, auto...){}(1, 1);
Leaving the parameter pack empty.
But it fails with this error:
> main.cpp: In function 'int main()':
> main.cpp:3:30: error: unable to deduce 'auto' from '& operator()<int, int>'
> auto ash = &decltype(test)::operator()<int, int>;
> ^~~~~~~~~~~~~~~~~~~~
> main.cpp:3:30: note: couldn't deduce template parameter 'auto'
The same happen when Sending two parameter in the pack:
int main() {
auto test = [](auto, auto, auto...) {};
auto ash = &decltype(test)::operator()<int, int, int, int>;
}
Note that taking the pointer when exactly one parameter fits in the pack, it
compiles fine:
int main() {
auto test = [](auto, auto, auto...) {};
auto ash = &decltype(test)::operator()<int, int, int>;
}
All of the example above compiles fine under clang.
More information about the Gcc-bugs
mailing list