[llvm-bugs] [Bug 36273] New: Warnings on deprecated enumerators in switch statements are not useful

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 7 07:39:14 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36273

            Bug ID: 36273
           Summary: Warnings on deprecated enumerators in switch
                    statements are not useful
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ibiryukov at google.com
                CC: llvm-bugs at lists.llvm.org

In the following code clang will complain about deprecated enumerator:

// clang++ -std=c++11 input.cpp
enum X {
  a = 1,
  b [[deprecated]] = 2,
};

int foo(X x) {
  switch(x) {
    case a:
      return 10;
    case b: // complains that 'b' is deprecated
      return 15;
  }
  return 20;
}

However, removing 'case b' will cause clang to complain about enumeration value
unhandled in the switch.

Maybe we should consider silencing the deprecation warnings in that case?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180207/35467b81/attachment.html>


More information about the llvm-bugs mailing list