From 2e1799aa78192df1a916be38f5fb0819857cce3e Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 3 Oct 2024 18:24:54 +0300 Subject: [PATCH] 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()::' 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. --- src/tests/sampling_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/sampling_test.cc b/src/tests/sampling_test.cc index f127624..4aabea4 100644 --- a/src/tests/sampling_test.cc +++ b/src/tests/sampling_test.cc @@ -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));