Skip to content

RTTI lacks const correctness #79

Description

@mingxwa

proxy_cast_dispatch guarded a reference result with std::is_const_v<T>, where T is the deduced operand type and is therefore always a reference. A reference type is never const, so the guard never fired and a caller could ask a const proxy for a mutable reference to what it contains and get one, silently casting the constness away.

const pro::proxy<F> p = pro::make_proxy<F, int>(123);
proxy_cast<int&>(*p) = 456;  // compiled, and mutated the contained value

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions