}
/* Warn about enum/integer type mismatches. They are compatible types
(C2X 6.7.2.2/5), but may pose portability problems. */
- else if (enum_and_int_p && TREE_CODE (newdecl) != TYPE_DECL)
+ else if (enum_and_int_p
+ && TREE_CODE (newdecl) != TYPE_DECL
+ /* Don't warn about about acc_on_device built-in redeclaration,
+ the built-in is declared with int rather than enum because
+ the enum isn't intrinsic. */
+ && !(TREE_CODE (olddecl) == FUNCTION_DECL
+ && fndecl_built_in_p (olddecl, BUILT_IN_ACC_ON_DEVICE)
+ && !C_DECL_DECLARED_BUILTIN (olddecl)))
warned = warning_at (DECL_SOURCE_LOCATION (newdecl),
OPT_Wenum_int_mismatch,
"conflicting types for %q+D due to enum/integer "
--- /dev/null
+/* PR c/107041 */
+/* { dg-do compile } */
+/* { dg-additional-options "-Wenum-int-mismatch" } */
+
+typedef enum acc_device_t {
+ acc_device_current = -1,
+ acc_device_none = 0,
+ acc_device_default = 1,
+ acc_device_host = 2,
+ acc_device_not_host = 4,
+ acc_device_nvidia = 5,
+ acc_device_radeon = 8,
+ _ACC_highest = __INT_MAX__
+} acc_device_t;
+
+int acc_on_device (acc_device_t); /* { dg-bogus "conflicting types for 'acc_on_device' due to enum/integer mismatch; have 'int\\\(acc_device_t\\\)'" } */
+int acc_on_device (acc_device_t);
+
+int
+foo (void)
+{
+ return acc_on_device (acc_device_host);
+}