fix: avoid copy constructor instantiation in shared_ptr fallback cast (#6028)

* tests: add regressions for shared_ptr reference_internal fallback

* fix: avoid copy constructor instantiation in shared_ptr fallback cast

* Remove stray empty line

* tests: rename PyTorch shared_ptr regression test files

* refactor: add cast_non_owning helper for reference-like casts

Name the non-owning generic cast path so callers do not have to rediscover that
reference-like policies must pass null copy/move constructor callbacks. This
keeps the shared_ptr reference_internal fallback self-documenting and points
future maintainers toward the safe API.

Made-with: Cursor

* tests: guard deprecated-copy warning probes with __has_warning

Use __has_warning for the Clang-only regression test so older compiler jobs skip
unsupported warning groups instead of failing with -Wunknown-warning-option. A
simple __clang_major__ >= 13 guard would be shorter, but it bakes in a version
cutoff; __has_warning is slightly more verbose while being more robust to
vendor builds, backports, and future packaging differences.

Made-with: Cursor

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
6 files changed