* doc/invoke.texi (C++ Dialect Options): Document -Wno-narrowing.
From-SVN: r176670
This commit is contained in:
parent
5b960c5a6e
commit
15c2ccbac5
3 changed files with 21 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
|||
2011-07-22 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* doc/invoke.texi (C++ Dialect Options): Document -Wno-narrowing.
|
||||
|
||||
2011-07-22 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* bb-reorder.c (gate_handle_partition_blocks): Honor optimize.
|
||||
|
|
|
@ -2348,6 +2348,18 @@ an instance of a derived class through a pointer to a base class if the
|
|||
base class does not have a virtual destructor. This warning is enabled
|
||||
by @option{-Wall}.
|
||||
|
||||
@item -Wno-narrowing @r{(C++ and Objective-C++ only)}
|
||||
@opindex Wnarrowing
|
||||
@opindex Wno-narrowing
|
||||
With -std=c++0x, suppress the diagnostic required by the standard for
|
||||
narrowing conversions within @samp{@{ @}}, e.g.
|
||||
|
||||
@smallexample
|
||||
int i = @{ 2.2 @}; // error: narrowing from double to int
|
||||
@end smallexample
|
||||
|
||||
This flag can be useful for compiling valid C++98 code in C++0x mode.
|
||||
|
||||
@item -Wnoexcept @r{(C++ and Objective-C++ only)}
|
||||
@opindex Wnoexcept
|
||||
@opindex Wno-noexcept
|
||||
|
|
5
gcc/testsuite/g++.dg/cpp0x/initlist55.C
Normal file
5
gcc/testsuite/g++.dg/cpp0x/initlist55.C
Normal file
|
@ -0,0 +1,5 @@
|
|||
// Test for -Wno-narrowing
|
||||
// { dg-options "-std=c++0x -pedantic-errors -Wno-narrowing" }
|
||||
|
||||
int i;
|
||||
float d = { i };
|
Loading…
Add table
Reference in a new issue