http://llvm.org/bugs/show_bug.cgi?id=14826
Bug #: 14826
Summary: Trying to give a default argument to a lambda
operator() by a friend declaration talks about "lambda
expression"
Product: clang
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++11
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
I tried to induce a default argument to operator()
#include <iostream>
auto x = [](int a) { std::cout << a << std::endl; };
struct X {
friend void decltype(x)::operator()(int a = 0) const;
};
int main() {
x();
}
Clang gets confused and says
main.cpp:6:43: warning: C++11 forbids default arguments for lambda expressions
[-Wlambda-extensions]
friend void decltype(x)::operator()(int a = 0) const;
However I am not putting the default argument in the lambda expression, but
trying to do so in a friend declaration. It should complain about *that*.
Perhaps the reason for this is that it does not do so in other cases either:
#include <iostream>
struct A { void operator()(int a) const; } x;
struct X {
friend void decltype(x)::operator()(int a = 0) const;
};
int main() {
x();
}
Should fail to compile, but allows the specification of the default argument.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs