Skip to content

std.io.driver.globalDriver(): Fix invalid reinterpret-cast#30

Merged
schveiguy merged 1 commit intoschveiguy:masterfrom
kinke:patch-2
Nov 7, 2019
Merged

std.io.driver.globalDriver(): Fix invalid reinterpret-cast#30
schveiguy merged 1 commit intoschveiguy:masterfrom
kinke:patch-2

Conversation

@kinke
Copy link
Contributor

@kinke kinke commented Nov 7, 2019

No description provided.

@schveiguy
Copy link
Owner

schveiguy commented Nov 7, 2019

Why is the cast invalid? It's changing from immutable Driver * to shared(Driver)*? In fact, I'd say the new cast is not valid.

@kinke
Copy link
Contributor Author

kinke commented Nov 7, 2019

Reinterpreting an interface reference as class reference doesn't offset as it should, because the cas() implementation then treats that reference as regular SyncDriver class reference, and offsets that back to the interface pointer (in a CAS implementation fixed in LDC 1.18).

@schveiguy
Copy link
Owner

It should all be in the realm of interface, there are no classes here. _syncDriver should already be adjusted as it's typed as immutable Driver. Maybe LDC is doing something too clever here?

@schveiguy
Copy link
Owner

Crap, I misread what was being deleted and added. Yes, your new code should be right.

@schveiguy
Copy link
Owner

I'm going to put your code in with #28 instead of here, because the current CI doesn't test properly (yet), it uses the latest DMD which has a broken cas.

@schveiguy schveiguy merged commit e246d55 into schveiguy:master Nov 7, 2019
@schveiguy
Copy link
Owner

Actually, I just decided to pull it. It's obviously correct. And I'd like to keep #28 focused on adding the meson build (even though it does technically also fix the normal build).

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