Skip to content

Ensuring that poly<C, non_owning_storage, V> is trivially copyable. - #57

Open
brevzin wants to merge 1 commit into
ldionne:masterfrom
brevzin:trivially-copyable
Open

Ensuring that poly<C, non_owning_storage, V> is trivially copyable.#57
brevzin wants to merge 1 commit into
ldionne:masterfrom
brevzin:trivially-copyable

Conversation

@brevzin

@brevzin brevzin commented Jan 14, 2019

Copy link
Copy Markdown

This is the boring boilerplate bullshit that makes it possible for poly<C, non_owning_storage> to be trivially copyable - which is just a nice thing in certain contexts. There are more steps to take to improve this (i.e. there are several concepts that make no sense to type erase for non_owning_storage and we can just remove them), so this is just the first go.

@brevzin

brevzin commented Jan 14, 2019

Copy link
Copy Markdown
Author

I... don't understand the failure, sorry. You're gonna have to give me a hint:

In file included from /home/travis/build/ldionne/dyno/benchmark/n_functions.cpp:7:0:
/home/travis/build/ldionne/dyno/dependencies/install/include/benchmark/benchmark.h: In instantiation of ‘void benchmark::DoNotOptimize(Tp&) [with Tp = {anonymous}::handrolled_local::any]’:
/home/travis/build/ldionne/dyno/benchmark/n_functions.cpp:231:31:   required from ‘void BM_any_1_function(benchmark::State&) [with Any = {anonymous}::handrolled_local::any]’
/home/travis/build/ldionne/dyno/benchmark/n_functions.cpp:294:1:   required from here
/home/travis/build/ldionne/dyno/dependencies/install/include/benchmark/benchmark.h:324:48: error: read-only reference ‘value’ used as ‘asm’ output
   asm volatile("" : "+m,r"(value) : : "memory");
                                                ^

@leokoppel

Copy link
Copy Markdown

Hi Barry, the build failure looks unrelated to this PR.

This error is caused by calling benchmark::DoNotOptimize with a non-const reference to an object that contains a const subobject. I see Louis has already reported the issue: google/benchmark#764

I'm just here because this was the only search result for "error: read-only reference" "used as ‘asm’ output", so hopefully that helps someone else 🙂

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