Bug 108456 - attribute deprecated on enum doesn't warn
Summary: attribute deprecated on enum doesn't warn
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2023-01-18 18:45 UTC by Marek Polacek
Modified: 2023-01-19 03:01 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Polacek 2023-01-18 18:45:14 UTC
In this test:

struct S {
  enum [[deprecated]] E { D };
};

int main()
{
  auto a1 = S::D;
  auto a2 = S::E::D;
}

we emit a -Wdeprecated-declarations warning only for a2 but not a1, whereas clang++ warns for a1 too (twice, in fact).  I suppose we want a warning there as well.

C++20 using enum test:

enum class [[deprecated]] E { X };

int main()
{
    using enum E;
    auto a = X;
}

clang++ warns but g++ doesn't.