Skip to content

[clang++-18] Unexpected deprecated-declarations warning, when this warning is explicitly suppressed #110321

@ralfkonrad

Description

@ralfkonrad

clang-18 shows an unexpected deprecated-declarations warning when a deprecated constructor is used in std::make_shared<T>(args from deprecated constructor...) while the warning is turned off using _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"").

On the other hand using std::shared_ptr<T>(new T(args from deprecated constructor...)) does not emit any warning as expected when it off.

Neiter clang-16 and clang-17 nor gcc on ubuntu-24.04 and msvc emit a warning.

The same behaviour can be seen with boost::shared_ptr instead of std::shared_ptr.

To reproduce this issue, see https://github.com/ralfkonrad/clang_deprecation_warning and its workflow results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions