From: Daniel Gutson Date: Mon, 28 Apr 2014 18:14:36 +0000 (+0000) Subject: typeck.c (build_reinterpret_cast_1): Pass proper argument to warn() in pedantic. X-Git-Tag: releases/gcc-4.8.3~110 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e35c0754b23bc8598b197457c0ad17416149fb0d;p=thirdparty%2Fgcc.git typeck.c (build_reinterpret_cast_1): Pass proper argument to warn() in pedantic. * typeck.c (build_reinterpret_cast_1): Pass proper argument to warn() in pedantic. From-SVN: r209870 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7359cb7d8dc0..b21c15f462fc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-04-28 Daniel Gutson + + * typeck.c (build_reinterpret_cast_1): Pass proper argument to + warn() in pedantic. + 2014-02-28 Jason Merrill PR c++/58845 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index b8e862cb3c73..2fa47025b7de 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -6649,7 +6649,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p, where possible, and it is necessary in some cases. DR 195 addresses this issue, but as of 2004/10/26 is still in drafting. */ - warning (0, "ISO C++ forbids casting between pointer-to-function and pointer-to-object"); + warning (OPT_Wpedantic, "ISO C++ forbids casting between pointer-to-function and pointer-to-object"); return fold_if_not_in_template (build_nop (type, expr)); } else if (TREE_CODE (type) == VECTOR_TYPE) diff --git a/gcc/testsuite/g++.dg/diagnostic/pedantic.C b/gcc/testsuite/g++.dg/diagnostic/pedantic.C new file mode 100644 index 000000000000..450a0fac63b0 --- /dev/null +++ b/gcc/testsuite/g++.dg/diagnostic/pedantic.C @@ -0,0 +1,11 @@ +// { dg-do compile } +// { dg-options "-pedantic" } +typedef void F(void); + +void foo() +{ + void* p = 0; + F* f1 = reinterpret_cast(p); // { dg-warning "ISO" } +#pragma GCC diagnostic ignored "-pedantic" + F* f2 = reinterpret_cast(p); +}