[LLVMbugs] [Bug 14826] New: Trying to give a default argument to a lambda operator() by a friend declaration talks about "lambda expression"
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Jan 7 00:20:00 PST 2013
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: unassignedclangbugs at nondot.org
ReportedBy: schaub.johannes at googlemail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
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.
More information about the llvm-bugs
mailing list