[llvm-bugs] [Bug 36231] New: -Wswitch ignores [[maybe_unused]]

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Feb 4 08:17:31 PST 2018


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

            Bug ID: 36231
           Summary: -Wswitch ignores [[maybe_unused]]
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jvapen at gmail.com
                CC: llvm-bugs at lists.llvm.org

enum A
{
    B,
    C [[maybe_unused]]
};

void f(A a)
{
    switch (a)
    {
        case B: break;
    }
}

Results into:

<source>:9:13: warning: enumeration value 'C' not handled in switch [-Wswitch]
    switch (a)
            ^

[[maybe_unused]] is allowed to be placed at this location and the only use case
I could come up with, does not work.

Some discussion about this can be found on
https://stackoverflow.com/q/48488635/2466431 although, no conclusion was
reached on this assumption being right or not.

-- 
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/20180204/d67e360a/attachment.html>


More information about the llvm-bugs mailing list