+2009-02-03 Jason Merrill <jason@redhat.com>
+
+ * typeck.c (cp_build_unary_op): Only complain about taking address
+ of main if pedantic.
+
2009-02-03 Jakub Jelinek <jakub@redhat.com>
PR inline-asm/39059
arg = build1 (CONVERT_EXPR, type, arg);
return arg;
}
- else if (DECL_MAIN_P (arg))
+ else if (pedantic && DECL_MAIN_P (arg))
{
/* ARM $3.4 */
- if (complain & tf_error)
- permerror (input_location, "ISO C++ forbids taking address of function %<::main%>");
- else
+ /* Apparently a lot of autoconf scripts for C++ packages do this,
+ so only complain if -pedantic. */
+ if (complain & (flag_pedantic_errors ? tf_error : tf_warning))
+ pedwarn (input_location, OPT_pedantic,
+ "ISO C++ forbids taking address of function %<::main%>");
+ else if (flag_pedantic_errors)
return error_mark_node;
}
+2009-02-03 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/warn/main-4.C: New test.
+ * g++.old-deja/g++.bugs/900227_01.C: Remove &main warnings.
+
2009-02-03 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C++/36607
--- /dev/null
+// This pattern is used by a lot of autoconf scripts, so don't
+// complain about it unless -pedantic.
+// { dg-options "" }
+
+int main () { main (); return 0; }
int main ();
-short s = (short) &main; // { dg-error "taking address" "addr" { xfail h8*-*-* xstormy16-*-* } }
-// { dg-error "loses precision" "lose" { xfail h8*-*-* xstormy16-*-* } 36 }
-char c = (char) &main; // { dg-error "taking address" }
-// { dg-error "loses precision" "lose" { target *-*-* } 38 }
+short s = (short) &main; // { dg-error "loses precision" "lose" { xfail h8*-*-* xstormy16-*-* } }
+char c = (char) &main; // { dg-error "loses precision" "lose" }
int main () { return 0; }