mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 12:00:11 -05:00
gcc/cp: * parser.c (cp_parser_primary_expression): If parsing an objective-c++ message expression fails, see if a lambda is present. (cp_parser_objc_message_receiver): Don't assume that, if a message receiver expression fails, it is a hard error. gcc/testsuite: * obj-c++.dg/lambda-0.mm New. * obj-c++.dg/lambda-1.mm New. * obj-c++.dg/syntax-error-6.mm Adjust for revised error messages. From-SVN: r219125
23 lines
390 B
Plaintext
23 lines
390 B
Plaintext
// Contributed by Iain Sandoe <iain@codesourcery.com>, December 2014. */
|
|
// { dg-do compile }
|
|
// { dg-options "-std=c++11" }
|
|
|
|
|
|
template<class Function>
|
|
Function thing(Function fn, int a)
|
|
{
|
|
fn(a);
|
|
return fn;
|
|
}
|
|
|
|
int
|
|
test (int *arr, unsigned n)
|
|
{
|
|
int total = 0;
|
|
for (unsigned i=0; i<n; i++) {
|
|
int a = arr[i];
|
|
thing ([&total] (int a) { total += a; }, a);
|
|
}
|
|
return total;
|
|
}
|