if (args1 == NULL_TREE)
{
- if (!self_promoting_args_p (args2))
+ if (flag_isoc2x ? stdarg_p (f2) : !self_promoting_args_p (args2))
return 0;
/* If one of these types comes from a non-prototype fn definition,
compare that with the other type's arglist.
}
if (args2 == NULL_TREE)
{
- if (!self_promoting_args_p (args1))
+ if (flag_isoc2x ? stdarg_p (f1) : !self_promoting_args_p (args1))
return 0;
if (TYPE_ACTUAL_ARG_TYPES (f2)
&& type_lists_compatible_p (args1, TYPE_ACTUAL_ARG_TYPES (f2),
--- /dev/null
+/* Test compatibility of unprototyped and prototyped function types (C2x makes
+ the case of types affected by default argument promotions compatible). Test
+ valid-in-C2x usages are not accepted for C11. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+void f1 (); /* { dg-message "previous declaration" } */
+void f1 (float); /* { dg-error "conflicting types" } */
+/* { dg-message "default promotion" "" { target *-*-* } .-1 } */
+
+void f2 (float); /* { dg-message "previous declaration" } */
+void f2 (); /* { dg-error "conflicting types" } */
+/* { dg-message "default promotion" "" { target *-*-* } .-1 } */
+
+void f3 (); /* { dg-message "previous declaration" } */
+void f3 (char); /* { dg-error "conflicting types" } */
+/* { dg-message "default promotion" "" { target *-*-* } .-1 } */
+
+void f4 (char); /* { dg-message "previous declaration" } */
+void f4 (); /* { dg-error "conflicting types" } */
+/* { dg-message "default promotion" "" { target *-*-* } .-1 } */
+
+/* Built-in function case. */
+float sqrtf (); /* { dg-warning "conflicting types for built-in function" } */
--- /dev/null
+/* Test compatibility of unprototyped and prototyped function types (C2x makes
+ the case of types affected by default argument promotions compatible). Test
+ invalid-in-C2x usages, in C11 mode. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+void f1 (); /* { dg-message "previous declaration" } */
+void f1 (int, ...); /* { dg-error "conflicting types" } */
+/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
+
+void f2 (int, ...); /* { dg-message "previous declaration" } */
+void f2 (); /* { dg-error "conflicting types" } */
+/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
+
+void f3 (); /* { dg-message "previous declaration" } */
+void f3 (char, ...); /* { dg-error "conflicting types" } */
+/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
+
+void f4 (char, ...); /* { dg-message "previous declaration" } */
+void f4 (); /* { dg-error "conflicting types" } */
+/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
--- /dev/null
+/* Test compatibility of unprototyped and prototyped function types (C2x makes
+ the case of types affected by default argument promotions compatible). Test
+ valid-in-C2x usages. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+void f1 ();
+void f1 (float);
+
+void f2 (float);
+void f2 ();
+
+void f3 ();
+void f3 (char);
+
+void f4 (char);
+void f4 ();
+
+/* Built-in function case. */
+float sqrtf ();
--- /dev/null
+/* Test compatibility of unprototyped and prototyped function types (C2x makes
+ the case of types affected by default argument promotions compatible). Test
+ invalid-in-C2x usages. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+void f1 (); /* { dg-message "previous declaration" } */
+void f1 (int, ...); /* { dg-error "conflicting types" } */
+/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
+
+void f2 (int, ...); /* { dg-message "previous declaration" } */
+void f2 (); /* { dg-error "conflicting types" } */
+/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
+
+void f3 (); /* { dg-message "previous declaration" } */
+void f3 (char, ...); /* { dg-error "conflicting types" } */
+/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */
+
+void f4 (char, ...); /* { dg-message "previous declaration" } */
+void f4 (); /* { dg-error "conflicting types" } */
+/* { dg-message "ellipsis" "" { target *-*-* } .-1 } */