Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gcc 10 compilation error #1566

Merged
merged 1 commit into from
Oct 3, 2024
Merged

Fix gcc 10 compilation error #1566

merged 1 commit into from
Oct 3, 2024

Conversation

Lastique
Copy link
Contributor

@Lastique Lastique commented Oct 3, 2024

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.

gcc 10.2.1 is used as the system compiler in Debian 11 Bullseye.

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.
@alk alk merged commit 2e1799a into gperftools:master Oct 3, 2024
8 checks passed
@alk
Copy link
Contributor

alk commented Oct 3, 2024

Applied. Thanks.

@Lastique Lastique deleted the patch-1 branch October 3, 2024 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants