re PR c++/49793 ([C++0x] Narrowing conversion from int/short/char to double)

PR c++/49793
	* typeck2.c (check_narrowing): Downgrade permerror to pedwarn.
	Make conditional on -Wnarrowing.

From-SVN: r176665
This commit is contained in:
Jason Merrill 2011-07-22 20:14:46 -04:00 committed by Jason Merrill
parent 295331a419
commit 76f86d00d9
10 changed files with 26 additions and 8 deletions

View File

@ -1,5 +1,8 @@
2011-07-22 Jason Merrill <jason@redhat.com>
PR c++/49793
* c.opt (Wnarrowing): New.
PR c++/30112
* c-common.h: Declare c_linkage_bindings.
* c-pragma.c (handle_pragma_redefine_extname): Use it.

View File

@ -489,6 +489,10 @@ Wmultichar
C ObjC C++ ObjC++ Warning
Warn about use of multi-character character constants
Wnarrowing
C ObjC C++ ObjC++ Warning Var(warn_narrowing) Init(1)
-Wno-narrowing In C++0x mode, ignore ill-formed narrowing conversions within { }
Wnested-externs
C ObjC Var(warn_nested_externs) Warning
Warn about \"extern\" declarations not at file scope

View File

@ -1,3 +1,9 @@
2011-07-22 Jason Merrill <jason@redhat.com>
PR c++/49793
* typeck2.c (check_narrowing): Downgrade permerror to pedwarn.
Make conditional on -Wnarrowing.
2011-07-22 Ville Voutilainen <ville.voutilainen@gmail.com>
Warn about the use of final/override in non-c++0x mode, and

View File

@ -719,7 +719,7 @@ check_narrowing (tree type, tree init)
bool ok = true;
REAL_VALUE_TYPE d;
if (!ARITHMETIC_TYPE_P (type))
if (!warn_narrowing || !ARITHMETIC_TYPE_P (type))
return;
if (BRACE_ENCLOSED_INITIALIZER_P (init)
@ -777,8 +777,8 @@ check_narrowing (tree type, tree init)
}
if (!ok)
permerror (input_location, "narrowing conversion of %qE from %qT "
"to %qT inside { }", init, ftype, type);
pedwarn (input_location, OPT_Wnarrowing, "narrowing conversion of %qE "
"from %qT to %qT inside { }", init, ftype, type);
}
/* Process the initializer INIT for a variable of type TYPE, emitting

View File

@ -1,3 +1,8 @@
2011-07-22 Jason Merrill <jason@redhat.com>
PR c++/49793
* g++.dg/cpp0x/initlist55.C: New.
2011-07-23 Tobias Burnus <burnus@net-b.de>
PR fortran/49791

View File

@ -1,4 +1,4 @@
// { dg-options "-std=c++0x" }
// { dg-options "-std=c++0x -pedantic-errors" }
void f(int i);

View File

@ -1,5 +1,5 @@
// PR c++/44358
// { dg-options "-std=c++0x" }
// { dg-options "-std=c++0x -pedantic-errors" }
#include <initializer_list>

View File

@ -1,5 +1,5 @@
// Test for narrowing diagnostics
// { dg-options "-std=c++0x" }
// { dg-options "-std=c++0x -pedantic-errors" }
#include <initializer_list>

View File

@ -1,5 +1,5 @@
// PR c++/45378
// { dg-options -std=c++0x }
// { dg-options "-std=c++0x -pedantic-errors" }
int main()
{

View File

@ -1,5 +1,5 @@
// PR c++/37932
// { dg-options "-std=c++0x" }
// { dg-options "-std=c++0x -pedantic-errors" }
typedef enum { AA=1, BB=2 } my_enum;