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

            Bug ID: 23984
           Summary: -Wtautological-compare doesn't warn on comparing
                    default-initialized enums
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Consider this snippet, where someone tried to call GetVersion() but instead
default-initialized an enum:


$ cat test.cc
namespace base {
enum Version { kXP, kVista };
Version GetVersion();
}

void f() {
  if (base::Version() == base::kXP)
    ;
}


I'd expect that comparison to be flagged by -Wtautological-compare, but it
isn't:


$ bin/clang -Weverything test.cc -c
test.cc:6:6: warning: no previous prototype for function 'f'
[-Wmissing-prototypes]
void f() {
     ^
1 warning generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to