Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change cudf::scalar copy and move constructors to protected (#8857)
An instance of the `cudf::scalar` base class can currently through it's public copy constructor using the following example: ``` cudf::scalar b = cudf::numeric_scalar<int32_t>(8); ``` This line builds the numeric scalar instance, passes it to the base scalar's copy-ctor, and then destroys it. (Simpler example here to show that this is happening: https://godbolt.org/z/hGEGvsqjq ) This means that the `b` instance is actually a plain `cudf::scalar` with no derived type. Downcasting with dynamic_cast can runtime-check the object but we could have this line fail at compile time by making the `cudf::scalar` copy-ctor protected. We could make the ctor explicit but I think making it protected would more clearly communicate the intention of the class. This PR makes the `cudf::scalar` copy and move constructors protected to prevent instantiating a `cudf::scalar` at compile time. Authors: - David Wendt (https://github.com/davidwendt) Approvers: - Karthikeyan (https://github.com/karthikeyann) - Vyas Ramasubramani (https://github.com/vyasr) URL: #8857
- Loading branch information