http://llvm.org/bugs/show_bug.cgi?id=7359

           Summary: 'spurious "switch condition has bool value" warning'
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


#include <iostream>

#ifndef static_assert
#define static_assert(a) switch ((int)(a)) case 0: case ((int)(a)):
#endif /* static_assert */

int main() {

   static_assert(sizeof(int) == sizeof(unsigned int));
   return 0;
}


[gree...@grok2 ~]$ clang++ -Os clang_test2.cc 
clang_test2.cc:10:4: warning: switch condition has boolean value
   static_assert(sizeof(int) == sizeof(unsigned int));
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
clang_test2.cc:5:26: note: instantiated from:
#define static_assert(a) switch ((int)(a)) case 0: case ((int)(a)):
                         ^       ~~~~~~~~
1 warning generated.
[gree...@grok2 ~]$

// This is a work-around:
//#define static_assert(a) switch ((a) + 0) case 0: case ((a) + 0):

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- 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