Fix gcc 10 compilation error

Apparently, gcc 10 doesn't support trailing return types for lambdas with an attribute.

```
src/tests/sampling_test.cc: In lambda function:
src/tests/sampling_test.cc:70:56: error: expected '{' before '->' token
   70 |   auto local_noopt = [] (void* ptr) ATTRIBUTE_NOINLINE -> void* {
      |                                                        ^~
src/tests/sampling_test.cc: In function 'void* AllocateAllocate()':
src/tests/sampling_test.cc:70:56: error: base operand of '->' has non-pointer type 'AllocateAllocate()::<lambda(void*)>'
src/tests/sampling_test.cc:70:59: error: expected unqualified-id before 'void'
   70 |   auto local_noopt = [] (void* ptr) ATTRIBUTE_NOINLINE -> void* {
      |                                                           ^~~~
```

Remove the trailing return type as it is deduced from the `noopt` call anyway.
This commit is contained in:
Andrey Semashev 2024-10-03 18:24:54 +03:00 committed by Aliaksiej Kandracienka (aka Aliaksei Kandratsenka)
parent c7dcabf09a
commit 2e1799aa78

View File

@ -67,7 +67,7 @@ static std::string NaiveShellQuote(std::string_view arg) {
extern "C" ATTRIBUTE_NOINLINE
void* AllocateAllocate() {
auto local_noopt = [] (void* ptr) ATTRIBUTE_NOINLINE -> void* {
auto local_noopt = [] (void* ptr) ATTRIBUTE_NOINLINE {
return noopt(ptr);
};
return local_noopt(malloc(10000));